Пример #1
0
    def test_job_as_dict_without_exec(self):
        job = lsf.get_job(self.job.job_id, include_exec_info=False)
        job_dict = job.as_dict

        self._verify_job_dict_statuses(job_dict['statuses'])
        self._verify_job_dict_submit_portion(job_dict['submit'])

        self._verify_job_dict_additional_fields(job_dict)
        self.assertFalse('exHosts' in job_dict)
Пример #2
0
    def lsf_job_is_running(lsf_job_id):
        print "Checking on LSF job (%s)" % lsf_job_id
        lsf_job = lsf.get_job(lsf_job_id)

        job_data = lsf_job.as_dict
        statuses = job_data['statuses']
        result = 'RUN' in statuses

        print "LSF job (%s) is %srunning" % (lsf_job_id,
                '' if result else 'not ')
        return result
Пример #3
0
    def lsf_job_is_running(lsf_job_id):
        print "Checking on LSF job (%s)" % lsf_job_id
        lsf_job = lsf.get_job(lsf_job_id)

        job_data = lsf_job.as_dict
        statuses = job_data['statuses']
        result = 'RUN' in statuses

        print "LSF job (%s) is %srunning" % (lsf_job_id,
                                             '' if result else 'not ')
        return result
Пример #4
0
    def update_job_with_lsf_status(self, job_id):
        LOG.debug('Looking up job (%s) in DB', job_id,
                extra={'jobId': job_id})
        service_job = self.session.query(
            models.Job).get(job_id)
        service_job.awaiting_update = False
        LOG.debug('DB says Job (%s) has lsf id [%s]',
                job_id, service_job.lsf_job_id,
                extra={'jobId': job_id, 'lsfJobId': service_job.lsf_job_id})

        if service_job.lsf_job_id is None:
            service_job.set_status(statuses.errored,
                    message='LSF job id for job (%s) is None' % job_id)
            self.session.commit()
            return False

        else:
            LOG.debug("Querying LSF about job (%s) with lsf id [%s]",
                    job_id, service_job.lsf_job_id,
                    extra={'jobId': job_id, 'lsfJobId': service_job.lsf_job_id})
            lsf_job = lsf.get_job(service_job.lsf_job_id, include_exec_info=False)

            try:
                job_data = lsf_job.as_dict
            except InvalidJob:
                # this could happen if you poll too quickly after launching the
                # job, lets allow for retrying a set number of times.
                service_job.failed_update_count += 1

                LOG.exception("Exception occured while converting lsf"
                    " job to dictionary")

                if (service_job.failed_update_count >= MAX_FAILS):
                    service_job.set_status(statuses.errored,
                        message="Failed to update status too many times: %s"
                            % service_job.failed_update_count)

                self.session.commit()
                return False

            LOG.info("Setting status of job (%s) to %s", job_id,
                    pformat(job_data['statuses']),
                    extra={'jobId': job_id, 'lsfJobId': service_job.lsf_job_id})
            service_job.update_status(job_data['statuses'])
            service_job.update_poll_after()

        self.session.commit()
        return True
Пример #5
0
 def test_jobs_should_compare_by_ids(self):
     job2 = lsf.get_job(self.job.job_id)
     self.assertEqual(self.job, job2)
Пример #6
0
 def test_jobs_should_compare_by_ids(self):
     job2 = lsf.get_job(self.job.job_id)
     self.assertEqual(self.job, job2)