本文整理汇总了Python中pyasm.common.Config.get_section_values方法的典型用法代码示例。如果您正苦于以下问题:Python Config.get_section_values方法的具体用法?Python Config.get_section_values怎么用?Python Config.get_section_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Config
的用法示例。
在下文中一共展示了Config.get_section_values方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _execute
# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import get_section_values [as 别名]
#.........这里部分代码省略.........
for i in range(0, num_processes):
job_thread = ASyncThread()
job_thread.start()
tactic_threads.append(job_thread)
# Job Queue services
if start_job_queue:
num_processes = Config.get_value("services", "queue_process_count")
if not num_processes:
num_processes = 1
else:
num_processes = int(num_processes)
for i in range(0, num_processes):
job_thread = JobQueueThread(i)
job_thread.start()
tactic_threads.append(job_thread)
# Watch Folder services
if start_watch_folder:
search = Search("sthpw/watch_folder")
watch_folders = search.get_sobjects()
for watch_folder in watch_folders:
project_code = watch_folder.get("project_code")
base_dir = watch_folder.get("base_dir")
search_type = watch_folder.get("search_type")
process = watch_folder.get("process")
script_path = watch_folder.get("script_path")
watch_folder_code = watch_folder.get("code")
if not project_code:
print("Watch Folder missing project_code ... skipping")
continue
if not base_dir:
print("Watch Folder missing base_dir ... skipping")
continue
if not search_type:
print("Watch Folder missing search_type ... skipping")
continue
self.watch_folder_cleanup(base_dir)
watch_thread = WatchFolderThread(
project_code=project_code,
base_dir=base_dir,
search_type=search_type,
process=process,
script_path = script_path,
watch_folder_code=watch_folder_code
)
watch_thread.start()
tactic_threads.append(watch_thread)
# set up custom services
for service in custom_services:
kwargs = Config.get_section_values(service)
custom_thread = CustomPythonProcessThread(**kwargs)
custom_thread.start()
tactic_threads.append(custom_thread)
if len(tactic_threads) == 0:
print("\n")
print("No services started ...")
print("\n")
return
# create a separate thread for timed processes
# DEPRECATED
tactic_timed_thread = TacticTimedThread()
tactic_timed_thread.start()
tactic_threads.append(tactic_timed_thread)
# create a separate thread for scheduler processes
start_scheduler = Config.get_value("services", "scheduler")
if start_scheduler == 'true' or True:
tactic_scheduler_thread = TacticSchedulerThread()
tactic_scheduler_thread.set_dev(self.dev_mode)
tactic_scheduler_thread.start()
tactic_threads.append(tactic_scheduler_thread)
DbContainer.close_thread_sql()
self.tactic_threads = tactic_threads
if self.mode == "normal":
self.monitor()
示例2: get_display
# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import get_section_values [as 别名]
def get_display(my):
top = my.top
top.add_class("spt_db_config_top")
top.add_style("width: 430px")
top.add_style("min-height: 500")
top.add_style("padding: 15px")
top.add_style("margin-left: auto")
top.add_style("margin-right: auto")
top.add_color("background", "background", -10)
top.add_border()
title_wdg = DivWdg()
top.add(title_wdg)
title_wdg.add("System Configuration Setup")
title_wdg.add_style("font-size: 20px")
top.add("<hr/>")
top.add("<i style='opacity: 0.5'>%s</i><br/>" % Config.get_config_path())
top.add("<br/>")
checkin_keys=Config.get_section_values('checkin')
checkin_keys=checkin_keys.keys()
save_button = my.get_save_button(checkin_keys)
top.add(save_button)
vendor = Config.get_value("database", "vendor")
title_wdg = DivWdg()
top.add(title_wdg)
title_wdg.add("<b>Database Setup</b>")
title_wdg.add_style("margin-bottom: 10px")
db_select = SelectWdg("database/vendor")
db_select.set_option("labels", "SQLite|PostgreSQL|MySQL|Oracle|SQLServer")
db_select.set_option("values", "Sqlite|PostgreSQL|MySQL|Oracle|SQLServer")
db_select.set_value(vendor)
db_select.add_behavior( {
'type': 'change',
'cbjs_action': '''
var key;
if (bvr.src_el.value == 'Sqlite') {
key = 'Sqlite';
}
else {
key = 'Other';
}
var top = bvr.src_el.getParent(".spt_db_config_top");
var options_els = top.getElements(".spt_db_options");
for (var i = 0; i < options_els.length; i++) {
var vendor = options_els[i].getAttribute("spt_vendor");
if (vendor == key) {
spt.show(options_els[i]);
}
else {
spt.hide(options_els[i]);
}
}
'''
} )
option_div = DivWdg()
top.add(option_div)
option_div.add("Vendor: ")
option_div.add(db_select)
option_div.add_style("margin: 20px")
sqlite_wdg = my.get_sqlite_wdg()
option_div.add(sqlite_wdg)
otherdb_wdg = my.get_otherdb_wdg()
option_div.add(otherdb_wdg)
if vendor == 'Sqlite':
otherdb_wdg.add_style("display: none")
sqlite_wdg.add_style("display", "")
else:
otherdb_wdg.add_style("display", "")
sqlite_wdg.add_style("display: none")
test_button = ActionButtonWdg(title="<< Test >>", tip="Test connecting to database")
option_div.add(test_button)
test_button.add_style("margin-left: auto")
test_button.add_style("margin-right: auto")
test_button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_db_config_top");
var values = spt.api.Utility.get_input_values(top, null, false);
var class_name = 'tactic.ui.startup.DbConfigCbk';
#.........这里部分代码省略.........
示例3: execute
# 需要导入模块: from pyasm.common import Config [as 别名]
# 或者: from pyasm.common.Config import get_section_values [as 别名]
#.........这里部分代码省略.........
for i in range(0, num_processes):
job_thread = JobQueueThread()
job_thread.start()
tactic_threads.append(job_thread)
# Watch Folder services
if start_watch_folder:
search = Search("sthpw/watch_folder")
watch_folders = search.get_sobjects()
for watch_folder in watch_folders:
project_code = watch_folder.get("project_code")
base_dir = watch_folder.get("base_dir")
search_type = watch_folder.get("search_type")
process = watch_folder.get("process")
if not project_code:
print "Watch Folder missing project_code ... skipping"
continue
if not project_code:
print "Watch Folder missing base_dir ... skipping"
continue
if not search_type:
print "Watch Folder missing search_type ... skipping"
continue
watch_thread = WatchFolderThread(
project_code=project_code,
base_dir=base_dir,
search_type=search_type,
process=process
)
watch_thread.start()
tactic_threads.append(watch_thread)
# set up custom services
for service in custom_services:
kwargs = Config.get_section_values(service)
custom_thread = CustomPythonProcessThread(**kwargs)
custom_thread.start()
tactic_threads.append(custom_thread)
if len(tactic_threads) == 0:
print
print "No services started ..."
print
return
# create a separate thread for timed processes
# DEPRECATED
tactic_timed_thread = TacticTimedThread()
tactic_timed_thread.start()
tactic_threads.append(tactic_timed_thread)
# create a separate thread for scheduler processes
start_scheduler = Config.get_value("services", "scheduler")
if start_scheduler == 'true':
tactic_scheduler_thread = TacticSchedulerThread()
tactic_scheduler_thread.start()
tactic_threads.append(tactic_scheduler_thread)
DbContainer.close_thread_sql()
# check each thread every 20 seconds
while 1:
end = False
try:
if my.check_interval:
time.sleep(my.check_interval)
for tactic_thread in tactic_threads:
tactic_thread._check()
else:
# FIXME: break for now (for windows service)
break
except KeyboardInterrupt, e:
print "Keyboard interrupt ... exiting Tactic"
for tactic_thread in tactic_threads:
tactic_thread.end = True
end = True
if end:
break