def __init__(self, working_dir, config_path): super(MasterControlProgram, self).__init__() self.jobs = JobCollection() self.working_dir = working_dir self.config = manager.ConfigManager(config_path) self.context = command_context.CommandContext() self.state_watcher = statemanager.StateChangeWatcher() log.info('initialized')
def get_state_manager_from_config(config_path, working_dir): """Return a state manager from the configuration. """ config_manager = manager.ConfigManager(config_path) config_container = config_manager.load() state_config = config_container.get_master().state_persistence with tool_utils.working_dir(working_dir): return PersistenceManagerFactory.from_config(state_config)
def __init__(self, working_dir, config_path): super(MasterControlProgram, self).__init__() self.jobs = job.JobCollection() self.services = service.ServiceCollection() self.working_dir = working_dir self.crash_reporter = None self.config = manager.ConfigManager(config_path) self.context = command_context.CommandContext() self.event_recorder = event.get_recorder() self.event_recorder.ok('started') self.state_watcher = statemanager.StateChangeWatcher()
def read_config(args): return manager.ConfigManager( args.config_path).load().get_master().state_persistence
def setup_config_manager(self): self.temp_dir = tempfile.mkdtemp() self.manager = manager.ConfigManager(self.temp_dir) self.manifest = mock.create_autospec(manager.ManifestFile) self.manager.manifest = self.manifest
def get_container(config_path): config_manager = manager.ConfigManager(config_path) return config_manager.load()
for action in six.itervalues(job_config.actions): shape = 'invhouse' if not action.requires else 'rect' nodes.append("node [shape = %s]; %s" % (shape, action.name)) for required_action in action.requires: edges.append("%s -> %s" % (required_action, action.name)) return "digraph g{%s\n%s}" % ('\n'.join(nodes), '\n'.join(edges)) def get_job(config_container, namespace, job_name): if namespace not in config_container: raise ValueError("Unknown namespace: %s" % namespace) config = config_container[opts.namespace] if job_name not in config.jobs: raise ValueError("Could not find Job %s" % job_name) return config.jobs[job_name] if __name__ == '__main__': opts = parse_args() config_manager = manager.ConfigManager(opts.config) container = config_manager.load() job_config = get_job(container, opts.namespace, opts.name) graph = build_diagram(job_config) with open('%s.dot' % opts.name, 'w') as fh: fh.write(graph)
def get_current_config(config_path): config_manager = manager.ConfigManager(config_path) return config_manager.load()