コード例 #1
0
ファイル: client.py プロジェクト: isabella232/pyoozie
    def job_coordinator_update(self,
                               coordinator_id,
                               xml_path,
                               configuration=None):
        user = self._user or 'oozie'
        coord = self._fetch_coordinator_or_action(coordinator_id)
        if coord.status.is_active():
            conf = xml._coordinator_submission_xml(user,
                                                   xml_path,
                                                   configuration=configuration)
            if self._verbose:
                self.logger.info('Preparing to update coordinator %s:\n%s',
                                 xml_path, conf)
            reply = self._put('job/{}?action=update'.format(coordinator_id),
                              conf)

            if not reply or 'update' not in reply:
                raise exceptions.OozieException.operation_failed(
                    'update coordinator')

            if self._verbose:
                self.logger.info('Coordinator %s updated with diff %s',
                                 coordinator_id, reply['update']['diff'])

            return self.job_coordinator_info(coordinator_id=coordinator_id)
        else:
            raise exceptions.OozieException.operation_failed(
                'coordinator status must be active in order to update')
コード例 #2
0
ファイル: client.py プロジェクト: Kondasamy/pyoozie
 def jobs_submit_coordinator(self, xml_path, configuration=None):
     user = self._user or 'oozie'
     conf = xml._coordinator_submission_xml(user, xml_path, configuration=configuration)
     if self._verbose:
         self.logger.info('Preparing to submit coordinator %s:\n%s', xml_path, conf)
     reply = self._post('jobs', conf)
     if reply and 'id' in reply:
         if self._verbose:
             self.logger.info('New coordinator: %s', reply['id'])
         coord = self.job_coordinator_info(coordinator_id=reply['id'])
         return coord
     raise exceptions.OozieException.operation_failed('submit coordinator')
コード例 #3
0
def test_coordinator_submission_xml(username, coord_app_path):
    actual = xml._coordinator_submission_xml(username=username,
                                             coord_xml_path=coord_app_path,
                                             indent=True)
    assert tests.utils.xml_to_comparable_dict('''
    <configuration>
        <property>
            <name>oozie.coord.application.path</name>
            <value>/user/oozie/coordinators/descriptive-name</value>
        </property>
        <property>
            <name>user.name</name>
            <value>test</value>
        </property>
    </configuration>''') == tests.utils.xml_to_comparable_dict(actual)