def __testLocal__(): workingDir =os.path.dirname(os.path.abspath(__file__)) config_loader = FileConfigLoader("../test_data/build_configuration.json") config = config_loader.load_config() executor = CommandExecutor(config["Resources"],basePath=workingDir, verbose=True) builder = AppConfigurator(config_loader, executor) builder.apply()
def __testLocal__(): workingDir = os.path.dirname(os.path.abspath(__file__)) config_loader = FileConfigLoader("../test_data/build_configuration.json") config = config_loader.load_config() executor = CommandExecutor(config["Resources"], basePath=workingDir, verbose=True) builder = AppConfigurator(config_loader, executor) builder.apply()
def main(): print "Starting Configurator" print "Version", app_config.get_version() config_loader = get_config_loader() Workspace.set(os.path.dirname(config_loader.config_file)) custom_bundles = get_additional_bundles() custom_vars = get_additional_vars(sys.argv) if custom_bundles: config_loader.append_bundles(*custom_bundles) if custom_vars: config_loader.append_vars(*custom_vars) builder = AppConfigurator(config_loader, get_logger(), verbose=is_verbose(), debug_mode=False) execution_dir = None if "-dir" in sys.argv: execution_dir = sys.argv[sys.argv.index("-dir") + 1] ex_dir_expanded = os.path.abspath(os.path.expanduser(execution_dir)) builder.set_execution_dir(ex_dir_expanded) validator = ConfigurationValidator(config_loader.config_file) validation_result = validator.validate(config_loader.load_config(), ex_dir_expanded) if validation_result.is_valid: builder.exclude_bundles(get_excluded_bundles()) builder.include_bundles(get_included_bundles()) builder.apply() builder.logger.close() else: builder.logger.write(str(validation_result)) builder.logger.close() sys.exit(1)
def main(args=None, loger=None): if not args: args = sys.argv config_loader = get_config_loader(args) Workspace.set(os.path.dirname(config_loader.config_file)) custom_bundles = get_additional_bundles(args) custom_vars = get_additional_vars(args) if custom_bundles: config_loader.append_bundles(*custom_bundles) if custom_vars: config_loader.append_vars(*custom_vars) is_outside_loger = True if not loger: is_outside_loger = False loger = get_logger(args) builder = AppConfigurator(config_loader, loger, verbose=is_verbose(args), debug_mode=False) execution_dir = None if "-dir" in args: execution_dir = args[args.index("-dir") + 1] ex_dir_expanded = os.path.abspath(os.path.expanduser(execution_dir)) builder.set_execution_dir(ex_dir_expanded) validator = ConfigurationValidator(config_loader.config_file) validation_result = validator.validate(config_loader.load_config(), ex_dir_expanded) if validation_result.is_valid: builder.exclude_bundles(get_excluded_bundles(args)) builder.include_bundles(get_included_bundles(args)) builder.apply() if not is_outside_loger: builder.logger.close() else: builder.logger.write(str(validation_result)) if not is_outside_loger: builder.logger.close()
def on_configure_clicked(self): config_loader = FileConfigLoader(self.get_config_path()) builder = AppConfigurator(config_loader, ZmqChainedLoger(port), verbose=self.cb_verbose.isChecked(), debug_mode=self.cb_verbose.isChecked()) builder.set_execution_dir(self.working_dir) self.worker = ConfigRunnerThread(builder) self.set_message_receiver() self.worker.start() self.worker.finished.connect(self.on_worker_finished)
def run_config(identifier, platform, name): Workspace.set(workspace_path) filepath = os.path.join(workspace_path, identifier, platform, name) loader = FileConfigLoader(filepath) config = loader.dictionary c_loger = ConsoleLoger() s_loger = StringLoger() composite_log = CompositeLoger(*[c_loger, s_loger]) builder = AppConfigurator(loader, composite_log) builder.set_execution_dir(workspace_path) res_msg = '' try: builder.apply() except Exception,ex: res_msg+=ex.message+'\n'
def on_run_click(self): root_url = os.path.dirname(self.config_path) if os.name!='posix': root_url = '/'+root_url if self.build_output: self.build_output.close() self.build_output = ConsoleOutput() self.build_output.show() config_loader = FileConfigLoader(self.config_path) builder = AppConfigurator(config_loader, ZmqChainedLoger(1234)) builder.set_execution_dir(self.working_dir) builder.include_bundles(self.get_included_bundles()) self.set_message_receiver() #builder.apply() self.worker = ConfigRunnerThread(builder) self.worker.start() self.worker.finished.connect(self.on_worker_finished)
def job_start(identifier, platform, name): Workspace.set(workspace_path) filepath = os.path.join(workspace_path, identifier, platform, name) loader = FileConfigLoader(filepath) config = loader.dictionary c_loger = ConsoleLoger() s_loger = StringLoger() composite_log = CompositeLoger(*[c_loger, s_loger]) builder = AppConfigurator(loader, composite_log) job_output = "No Response" try: job_output = execute_job.delay(builder, workspace_path, workspace_path).get(100) except OSError, e: job_output = e.strerror job_output += '\nTraceback' + job_output.traceback
def run_config(identifier, platform, name): Workspace.set(workspace_path) filepath = os.path.join(workspace_path, identifier, platform, name) loader = FileConfigLoader(filepath) config = loader.dictionary c_loger = ConsoleLoger() s_loger = StringLoger() composite_log = CompositeLoger(*[c_loger, s_loger]) builder = AppConfigurator(loader, composite_log) working_dir = request.args.get('wd') if working_dir: builder.set_execution_dir(working_dir) else: builder.set_execution_dir(workspace_path) res_msg = '' try: builder.apply() except Exception, ex: res_msg += ex.message + '\n'
def on_run_click(self): root_url = os.path.dirname(self.config_path) if os.name != 'posix': root_url = '/' + root_url if self.build_output: self.build_output.close() self.build_output = ConsoleOutput() self.build_output.show() config_loader = FileConfigLoader(self.config_path) builder = AppConfigurator(config_loader, ZmqChainedLoger(1234), verbose=self.verbose) builder.set_execution_dir(self.working_dir) builder.include_bundles(self.get_included_bundles()) self.set_message_receiver() if self.debug: builder.apply() else: self.worker = ConfigRunnerThread(builder) self.worker.start() self.worker.finished.connect(self.on_worker_finished)
def __testRemote__(): config_loader = SvcConfigLoader(svcUrl, "testConfig") executor = CommandExecutor(verbose=True) builder = AppConfigurator(config_loader, executor) builder.apply()