Example #1
0
    def expect_populate(self, job_config, response_code=ResponseCode.OK):
        resp = make_response(response_code)
        config = deepcopy(job_config.taskConfig)
        resp.result = Result(populateJobResult=PopulateJobResult(
            taskConfig=config))

        self._scheduler.populateJobConfig(job_config).AndReturn(resp)
Example #2
0
 def expect_populate(self, job_config, response_code=None):
     response_code = ResponseCode.OK if response_code is None else response_code
     resp = Response(responseCode=response_code, messageDEPRECATED='test')
     result = set([deepcopy(job_config.taskConfig)])
     resp.result = Result(populateJobResult=PopulateJobResult(
         populatedDEPRECATED=result))
     self._scheduler.populateJobConfig(job_config).AndReturn(resp)
 def setup_populate_job_config(cls, api):
     populate = cls.create_simple_success_response()
     api.populateJobConfig.return_value = populate
     tasks = set(task.assignedTask.task
                 for task in cls.create_scheduled_tasks())
     populate.result = Result(populateJobResult=PopulateJobResult(
         populatedDEPRECATED=tasks, taskConfig=list(tasks)[0]))
     return populate
Example #4
0
 def setup_populate_job_config(cls, api):
   populate = cls.create_simple_success_response()
   populate.result = Result(populateJobResult=PopulateJobResult(
       populatedDEPRECATED={TaskConfig()},
       taskConfig=TaskConfig()
   ))
   api.populateJobConfig.return_value = populate
   return populate
Example #5
0
 def setup_populate_job_config(cls, api, count=20):
   populate = cls.create_simple_success_response()
   config = TaskConfig(
       numCpus=1.0,
       ramMb=1,
       diskMb=1,
       job=JobKey(role='bozo', environment='test', name='hello'))
   populate.result = Result(populateJobResult=PopulateJobResult(taskConfig=config))
   api.populateJobConfig.return_value = populate
   return populate
Example #6
0
 def setup_populate_job_config(cls, api, count=20):
     populate = cls.create_simple_success_response()
     configs = [
         TaskConfig(numCpus=1.0,
                    ramMb=1,
                    diskMb=1,
                    job=JobKey(role='bozo',
                               environment='test',
                               name='hello')) for i in range(count)
     ]
     populate.result = Result(populateJobResult=PopulateJobResult(
         populatedDEPRECATED=set(configs), taskConfig=configs[0]))
     api.populateJobConfig.return_value = populate
     return populate
Example #7
0
 def test_get_populated_task_config_set(self):
     config = TaskConfig()
     resp = Response(responseCode=ResponseCode.OK,
                     result=Result(populateJobResult=PopulateJobResult(
                         taskConfig=config)))
     assert config == resp.result.populateJobResult.taskConfig
 def test_get_populated_task_config_deprecated_set(self):
     config = TaskConfig()
     resp = Response(responseCode=ResponseCode.OK,
                     result=Result(populateJobResult=PopulateJobResult(
                         populatedDEPRECATED=set([config]))))
     assert config == base.get_populated_task_config(resp)
Example #9
0
 def setup_populate_job_config(cls, api):
     populate = cls.create_simple_success_response()
     api.populateJobConfig.return_value = populate
     populate.result = Result(populateJobResult=PopulateJobResult(
         taskConfig=cls.create_scheduled_tasks()[0].assignedTask.task))
     return populate
Example #10
0
 def populate_job_config_result(cls):
   populate = cls.create_simple_success_response()
   populate.result = Result(populateJobResult=PopulateJobResult(
       taskConfig=cls.create_scheduled_tasks()[0].assignedTask.task))
   return populate