Exemple #1
0
 def from_kvs(job_id):
     """Return the job in the underlying kvs system with the given id."""
     params = kvs.get_value_json_decoded(
         kvs.tokens.generate_job_key(job_id))
     job_profile = profile4job(job_id)
     job = OqJob.objects.get(id=job_id)
     job = JobContext(params, job_id, oq_job_profile=job_profile,
                      oq_job=job, log_level=params['debug'])
     return job
Exemple #2
0
    def teardown_job(cls, job, filesystem_only=True):
        """
        Tear down the file system (and potentially db) artefacts for the
        given job.

        :param job: a :py:class:`db.models.OqJob` instance
        :param bool filesystem_only: if set the oq_job/oq_param/
            input database records will be left intact. This saves time and the
            test db will be dropped/recreated prior to the next db test suite
            run anyway.
        """
        DbTestCase.teardown_inputs(models.inputs4job(job.id),
                                   filesystem_only=filesystem_only)
        if filesystem_only:
            return

        job.delete()
        try:
            oqjp = models.profile4job(job.id)
            oqjp.delete()
        except ValueError:
            # no job profile for this job
            pass
Exemple #3
0
 def test_profile4job_with_existing(self):
     # The correct job profile is found.
     job = self.setup_classic_job()
     self.assertIsNot(None, models.profile4job(job.id))
Exemple #4
0
 def _reload_params(self):
     return models.profile4job(self.job.id)