示例#1
0
 def __init__(self,
              name,
              scheduler,
              queueing=True,
              all_nodes=False,
              node_pool=None,
              enabled=True,
              action_graph=None,
              run_collection=None,
              parent_context=None,
              output_path=None,
              allow_overlap=None,
              action_runner=None,
              max_runtime=None):
     super(Job, self).__init__()
     self.name = name
     self.action_graph = action_graph
     self.scheduler = scheduler
     self.runs = run_collection
     self.queueing = queueing
     self.all_nodes = all_nodes
     self.enabled = enabled
     self.node_pool = node_pool
     self.allow_overlap = allow_overlap
     self.action_runner = action_runner
     self.max_runtime = max_runtime
     self.output_path = output_path or filehandler.OutputPath()
     self.output_path.append(name)
     self.event = event.get_recorder(self.name)
     self.context = command_context.build_context(self, parent_context)
     self.event.ok('created')
示例#2
0
    def __init__(self,
                 job_name,
                 run_num,
                 run_time,
                 node,
                 output_path=None,
                 base_context=None,
                 action_runs=None,
                 action_graph=None,
                 manual=None):
        super(JobRun, self).__init__()
        self.job_name = job_name
        self.run_num = run_num
        self.run_time = run_time
        self.node = node
        self.output_path = output_path or filehandler.OutputPath()
        self.output_path.append(self.id)
        self.action_runs_proxy = None
        self._action_runs = None
        self.action_graph = action_graph
        self.manual = manual
        self.event = event.get_recorder(self.full_id)
        self.event.ok('created')

        if action_runs:
            self.action_runs = action_runs

        self.context = command_context.build_context(self, base_context)
示例#3
0
文件: job.py 项目: ContextLogic/Tron
 def __init__(self, name, scheduler, queueing=True, all_nodes=False,
         node_pool=None, enabled=True, action_graph=None,
         run_collection=None, parent_context=None, output_path=None,
         allow_overlap=None, action_runner=None, max_runtime=None,
         email_name=None, email=None, command=None, priority=None,
         owner=None, impact=None, expected_runtime=None, num_retries=None):
     super(Job, self).__init__()
     self.name               = name
     self.email_name         = name.split(".")[1].replace('_', ' ')
     self.email              = email
     self.command            = command
     self.priority           = priority
     self.owner              = owner
     self.impact             = impact
     self.action_graph       = action_graph
     self.scheduler          = scheduler
     self.runs               = run_collection
     self.queueing           = queueing
     self.all_nodes          = all_nodes
     self.enabled            = enabled
     self.node_pool          = node_pool
     self.allow_overlap      = allow_overlap
     self.action_runner      = action_runner
     self.max_runtime        = max_runtime
     self.expected_runtime   = expected_runtime
     self.num_retries        = num_retries
     self.output_path        = output_path or filehandler.OutputPath()
     self.output_path.append(name)
     self.event              = event.get_recorder(self.name)
     self.context = command_context.build_context(self, parent_context)
     self.event.ok('created')
示例#4
0
 def __init__(self, name, scheduler, queueing=True, all_nodes=False,
         owner='', summary='', notes='',
         node_pool=None, enabled=True, action_graph=None,
         run_collection=None, parent_context=None, output_path=None,
         allow_overlap=None, action_runner=None, max_runtime=None):
     super(Job, self).__init__()
     self.name               = name
     self.owner              = owner
     self.summary            = summary
     self.notes              = notes
     self.action_graph       = action_graph
     self.scheduler          = scheduler
     self.runs               = run_collection
     self.queueing           = queueing
     self.all_nodes          = all_nodes
     self.enabled            = enabled
     self.node_pool          = node_pool
     self.allow_overlap      = allow_overlap
     self.action_runner      = action_runner
     self.max_runtime        = max_runtime
     self.output_path        = output_path or filehandler.OutputPath()
     self.output_path.append(name)
     self.event              = event.get_recorder(self.name)
     self.context = command_context.build_context(self, parent_context)
     self.event.ok('created')
示例#5
0
文件: service.py 项目: wfxiang08/Tron
 def __init__(self, config, instance_collection):
     super(Service, self).__init__()
     self.config = config
     self.instances = instance_collection
     self.enabled = False
     args = config.restart_delay, self.repair
     self.repair_callback = eventloop.UniqueCallback(*args)
     self.event_recorder = event.get_recorder(str(self))
示例#6
0
 def test_render_GET(self):
     recorder = event.get_recorder(self.name)
     ok_message, critical_message ='ok message', 'critical message'
     recorder.ok(ok_message)
     recorder.critical(critical_message)
     response = self.resource.render_GET(self.request())
     names = [e['name'] for e in response['data']]
     assert_equal(names, [ok_message, critical_message])
示例#7
0
 def __init__(self, config, instance_collection):
     super(Service, self).__init__()
     self.config = config
     self.instances = instance_collection
     self.enabled = False
     args = config.restart_delay, self.repair
     self.repair_callback = eventloop.UniqueCallback(*args)
     self.event_recorder = event.get_recorder(str(self))
示例#8
0
 def test_render_GET(self):
     recorder = event.get_recorder(self.name)
     ok_message, critical_message = 'ok message', 'critical message'
     recorder.ok(ok_message)
     recorder.critical(critical_message)
     response = self.resource.render_GET(self.request())
     names = [e['name'] for e in response['data']]
     assert_equal(names, [critical_message, ok_message])
示例#9
0
 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()
示例#10
0
 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()
示例#11
0
 def __init__(self,
              name,
              scheduler,
              queueing=True,
              all_nodes=False,
              node_pool=None,
              enabled=True,
              action_graph=None,
              run_collection=None,
              parent_context=None,
              output_path=None,
              allow_overlap=None,
              action_runner=None,
              max_runtime=None,
              email_name=None,
              email=None,
              command=None,
              priority=None,
              owner=None,
              impact=None,
              expected_runtime=None,
              num_retries=None):
     super(Job, self).__init__()
     self.name = name
     self.email_name = name.split(".")[1].replace('_', ' ')
     self.email = email
     self.command = command
     self.priority = priority
     self.owner = owner
     self.impact = impact
     self.action_graph = action_graph
     self.scheduler = scheduler
     self.runs = run_collection
     self.queueing = queueing
     self.all_nodes = all_nodes
     self.enabled = enabled
     self.node_pool = node_pool
     self.allow_overlap = allow_overlap
     self.action_runner = action_runner
     self.max_runtime = max_runtime
     self.expected_runtime = expected_runtime
     self.num_retries = num_retries
     self.output_path = output_path or filehandler.OutputPath()
     self.output_path.append(name)
     self.event = event.get_recorder(self.name)
     self.context = command_context.build_context(self, parent_context)
     self.event.ok('created')
示例#12
0
    def __init__(self, job_name, run_num, run_time, node, output_path=None,
                base_context=None, action_runs=None, action_graph=None,
                manual=None):
        super(JobRun, self).__init__()
        self.job_name           = job_name
        self.run_num            = run_num
        self.run_time           = run_time
        self.node               = node
        self.output_path        = output_path or filehandler.OutputPath()
        self.output_path.append(self.id)
        self.action_runs_proxy  = None
        self._action_runs       = None
        self.action_graph       = action_graph
        self.manual             = manual
        self.event              = event.get_recorder(self.id)
        self.event.ok('created')

        if action_runs:
            self.action_runs    = action_runs

        self.context = command_context.build_context(self, base_context)
示例#13
0
 def render_GET(self, request):
     recorder = event.get_recorder(self.entity_name)
     response_data = adapter.adapt_many(adapter.EventAdapter, recorder.list())
     return respond(request, dict(data=response_data))
示例#14
0
文件: resource.py 项目: nagyist/Tron
 def render_GET(self, request):
     recorder = event.get_recorder(self.entity_name)
     response_data = adapter.adapt_many(adapter.EventAdapter,
                                        recorder.list())
     return respond(request, dict(data=response_data))
示例#15
0
 def __init__(self, emailer):
     self.emailer        = emailer
     self.event_recorder = event.get_recorder(str(self))