def create_job(self, _type="IMPORT", name="test1", connection_id=1, connector_id=1): job = Job(_type, name, connection_id, connector_id) job.framework = self.client.get_framework().job_forms[_type] job.connector = self.client.get_connectors()[0].job_forms[_type] for _connector in job.connector: for _input in _connector.inputs: if _input.name not in JOB_FORM_VALUES: LOG.warning( "Job input mapping %s does not exist. Maybe it's new?" % _input.name) elif JOB_FORM_VALUES[_input.name]: _input.value = JOB_FORM_VALUES[_input.name] for _framework in job.framework: for _input in _framework.inputs: if _input.name not in FRAMEWORK_FORM_VALUES: LOG.warning( "Framework input mapping %s does not exist. Maybe it's new?" % _input.name) elif FRAMEWORK_FORM_VALUES[_input.name]: _input.value = FRAMEWORK_FORM_VALUES[_input.name] return self.client.create_job(job)
def create_job(self, name="test1", from_link_id=1, to_link_id=2, from_connector_id=1, to_connector_id=2): job = Job( name, from_link_id, to_link_id, from_connector_id, to_connector_id) job.driver_config = self.client.get_driver().job_config job.from_config = self.client.get_connectors()[0].job_config['FROM'] job.to_config = self.client.get_connectors()[0].job_config['TO'] for _from_config in job.from_config: for _input in _from_config.inputs: if _input.name not in FROM_JOB_CONFIG_VALUES: LOG.warning("From Job config input mapping %s does not exist. Maybe it's new?" % _input.name) elif FROM_JOB_CONFIG_VALUES[_input.name]: _input.value = FROM_JOB_CONFIG_VALUES[_input.name] for _to_config in job.to_config: for _input in _to_config.inputs: if _input.name not in TO_JOB_CONFIG_VALUES: LOG.warning("To Job config input mapping. Maybe it's new?" % _input.name) elif TO_JOB_CONFIG_VALUES[_input.name]: _input.value = TO_JOB_CONFIG_VALUES[_input.name] for _driver_config in job.driver_config: for _input in _driver_config.inputs: if _input.name not in DRIVER_CONFIG_VALUES: LOG.warning("Driver Job config input mapping. Maybe it's new?" % _input.name) elif DRIVER_CONFIG_VALUES[_input.name]: _input.value = DRIVER_CONFIG_VALUES[_input.name] return self.client.create_job(job)
def create_job(self, _type="IMPORT", name="test1", connection_id=1, connector_id=1): job = Job(_type, name, connection_id, connector_id) job.framework = self.client.get_framework().job_forms[_type] job.connector = self.client.get_connectors()[0].job_forms[_type] for _connector in job.connector: for _input in _connector.inputs: if JOB_FORM_VALUES[_input.name]: _input.value = JOB_FORM_VALUES[_input.name] for _framework in job.framework: for _input in _framework.inputs: if FRAMEWORK_FORM_VALUES[_input.name]: _input.value = FRAMEWORK_FORM_VALUES[_input.name] return self.client.create_job(job)
def create_job(self, _type="IMPORT", name="test1", connection_id=1, connector_id=1): job = Job(_type, name, connection_id, connector_id) job.framework = self.client.get_framework().job_forms[_type] job.connector = self.client.get_connectors()[0].job_forms[_type] for _connector in job.connector: for _input in _connector.inputs: if _input.name not in JOB_FORM_VALUES: LOG.warning("Job input mapping %s does not exist. Maybe it's new?" % _input.name) elif JOB_FORM_VALUES[_input.name]: _input.value = JOB_FORM_VALUES[_input.name] for _framework in job.framework: for _input in _framework.inputs: if _input.name not in FRAMEWORK_FORM_VALUES: LOG.warning("Framework input mapping %s does not exist. Maybe it's new?" % _input.name) elif FRAMEWORK_FORM_VALUES[_input.name]: _input.value = FRAMEWORK_FORM_VALUES[_input.name] return self.client.create_job(job)
def get_job(self, job_id): resp_dict = self._root.get('%s/job/%d/' % (API_VERSION, job_id), headers=self.headers) if resp_dict['job']: return Job.from_dict(resp_dict['job']) return None
def get_jobs(self): resp_dict = self._root.get('%s/jobs' % API_VERSION, headers=self.headers) jobs = [Job.from_dict(job_dict) for job_dict in resp_dict['jobs']] return jobs