Beispiel #1
0
    def test_record_job_stop_time(self):
        """
        Test that job stop time is recorded properly.
        """
        cstats = JobStats(oq_job=self.job, start_time=datetime.utcnow(), num_sites=10)
        cstats.save(using="job_superv")

        supervisor.record_job_stop_time(self.job.id)

        # Fetch the stats and check for the stop_time
        cstats = JobStats.objects.get(oq_job=self.job.id)
        self.assertTrue(cstats.stop_time is not None)
Beispiel #2
0
    def test_record_job_stop_time(self):
        """
        Test that job stop time is recorded properly.
        """
        cstats = JobStats(
            oq_job=self.job, start_time=datetime.utcnow(),
            num_sites=10)
        cstats.save(using='job_superv')

        supervisor.record_job_stop_time(self.job.id)

        # Fetch the stats and check for the stop_time
        cstats = JobStats.objects.get(oq_job=self.job.id)
        self.assertTrue(cstats.stop_time is not None)
Beispiel #3
0
    def _record_initial_stats(self):
        '''
        Report initial job stats (such as start time) by adding a
        uiapi.job_stats record to the db.
        '''
        job_stats = JobStats(oq_job=self.oq_job)
        job_stats.start_time = datetime.utcnow()
        job_stats.num_sites = len(self.sites_to_compute())

        calc_mode = CALCULATION_MODE[self['CALCULATION_MODE']]
        if jobconf.HAZARD_SECTION in self.sections:
            if calc_mode != 'scenario':
                job_stats.realizations = self["NUMBER_OF_LOGIC_TREE_SAMPLES"]

        job_stats.save()
Beispiel #4
0
    def _record_initial_stats(self):
        '''
        Report initial job stats (such as start time) by adding a
        uiapi.job_stats record to the db.
        '''
        job_stats = JobStats(oq_job=self.oq_job)
        job_stats.start_time = datetime.utcnow()
        job_stats.num_sites = len(self.sites_to_compute())

        calc_mode = CALCULATION_MODE[self['CALCULATION_MODE']]
        if jobconf.HAZARD_SECTION in self.sections:
            if calc_mode != 'scenario':
                job_stats.realizations = self["NUMBER_OF_LOGIC_TREE_SAMPLES"]

        job_stats.save()