Exemple #1
0
    def _run_job_error(self, job, run_time, exc, traceback=None):
        """Called by the dispatcher with the exception if there is an error calling `run_job`."""
#         with self._lock:
#             indices = [i for i, (f, rt) in enumerate(self._state[job.id]) if rt == run_time]
#             for i in indices:
#                 del self._state[job.id][i]
 
        exc_info = (exc.__class__, exc, traceback)
        logging.error('Error running job %s run_time %s' % (job.id, run_time), exc_info=exc_info)
        
        cost_ms = int ((datetime_to_utc_timestamp(datetime.now( get_localzone())) - datetime_to_utc_timestamp(run_time)) * 1000)
        add_result(job.conf, datetime_to_utc_timestamp(run_time), result=1, output=exc_info, cost_ms=cost_ms)
Exemple #2
0
    def _run_job_success(self, job, run_time, events):
        """Called by the dispatcher with the list of generated events when `run_job` has been successfully called."""
#         with self._lock:
#             #self._state[job.id].remove((f, run_time))
#             indices = [i for i, (f, rt) in enumerate(self._state[job.id]) if rt == run_time]
#             for i in indices:
#                 del self._state[job.id][i]
        
        cost_ms = int ((datetime_to_utc_timestamp(datetime.now( get_localzone())) - datetime_to_utc_timestamp(run_time)) * 1000)  
        for event in events:
            self._scheduler._dispatch_event(event)
            
        add_result(job.conf, datetime_to_utc_timestamp(run_time), result=0, output='ok', cost_ms=cost_ms)
Exemple #3
0
    def _run_job_error(self, job, run_time, exc, traceback=None):
        """Called by the dispatcher with the exception if there is an error calling `run_job`."""
        #         with self._lock:
        #             indices = [i for i, (f, rt) in enumerate(self._state[job.id]) if rt == run_time]
        #             for i in indices:
        #                 del self._state[job.id][i]

        exc_info = (exc.__class__, exc, traceback)
        logging.error('Error running job %s run_time %s' % (job.id, run_time),
                      exc_info=exc_info)

        cost_ms = int(
            (datetime_to_utc_timestamp(datetime.now(get_localzone())) -
             datetime_to_utc_timestamp(run_time)) * 1000)
        add_result(job.conf,
                   datetime_to_utc_timestamp(run_time),
                   result=1,
                   output=exc_info,
                   cost_ms=cost_ms)
Exemple #4
0
    def _run_job_success(self, job, run_time, events):
        """Called by the dispatcher with the list of generated events when `run_job` has been successfully called."""
        #         with self._lock:
        #             #self._state[job.id].remove((f, run_time))
        #             indices = [i for i, (f, rt) in enumerate(self._state[job.id]) if rt == run_time]
        #             for i in indices:
        #                 del self._state[job.id][i]

        cost_ms = int(
            (datetime_to_utc_timestamp(datetime.now(get_localzone())) -
             datetime_to_utc_timestamp(run_time)) * 1000)
        for event in events:
            self._scheduler._dispatch_event(event)

        add_result(job.conf,
                   datetime_to_utc_timestamp(run_time),
                   result=0,
                   output='ok',
                   cost_ms=cost_ms)