def __init__(self, is_daemon=True): Controller.__init__(self, Cluster.ADDR, "cluster", config.CLUSTER_LOG, config.LOG_LEVEL, is_daemon) self._logger.info("initialze controller done") self._initialized = 0 self._cc_detail = None self._inst_lock = None self._res_lock = None self._nccall_sem = None
def __init__(self, is_daemon=True): # initialize controller Controller.__init__(self, Node.ADDR, "node", config.NODE_LOG, config.LOG_LEVEL, is_daemon) self._logger.info("initialze controller done") # 0 no _initialized, 1 has been _initialized, -1 _initialized error or initialing. self._initialized = 0 self._global_instances = None self._nc_detail = None self._hyp_lock = None self._inst_lock = None self._res_lock = None
def wrapper(type): print("Route %s registered by %s" % (name, type)) Controller.registerController(name, type) pass
api_config = api_config_dict[api_model](args=sys.argv, prefix='api') doc_config = doc_config_dict[doc_model](args=sys.argv, prefix='doc') check_dir(config.model_path) # Get current cmd and git rev to make a snapshot. cmd = 'python3 -m api_emb.main ' + ' '.join(sys.argv[1:]) rev = get_cur_git_rev() msg = '"cmd": "{}",\n"rev": "{}"'.format(cmd, rev) save_configs([config, api_config, doc_config], ['config', 'api_config', 'doc_config'], path=os.path.join(config.model_path, config.config_file), msg=msg) config.api_config = api_config config.doc_config = doc_config controller = Controller(config, ApiDocVAE, api_model=model_dict[api_model], doc_model=model_dict[doc_model]) logging.info('*' * 80) logging.warn('Un-parsed args: {}'.format( str(set(sys.argv[1:]) - set(config.parsed_args)))) logging.info('*' * 80) logging.info('Using {} as api model, {} as doc model.'.format( api_model, doc_model)) controller.run()
from controllers.confirm import Confirm from controllers.costs import Costs from controllers.dashboard import Dashboard from controllers.reportController import ReportController from controllers.sales import Sales from controllers.testDev import TestDev from common.report import Report from controllers.reports.cost import CostReport from controllers.reports.installment import InstallmentReport from controllers.reports.order import OrderReport from controllers.reports.sale import SaleReport from controllers.reports.saleList import SaleListReport from controllers.reports.storage import StorageReport Controller.registerController('auth',Authentication) Controller.registerController('info',BasicInfo) Controller.registerController('confirm',Confirm) Controller.registerController('sale',Sales) Controller.registerController('test',TestDev) Controller.registerController('costs',Costs) Controller.registerController('dashboard',Dashboard) Controller.registerController('viewer',Viewer) Controller.registerController('report',Report) Controller.registerController('template',ReportController) Report.registerReport('cost',CostReport) Report.registerReport('instullment',InstallmentReport)
def run(): model = Model() controller = Controller(model) view = View(controller)