Example #1
0
 def as_printable_dict(self) -> dict:
     run_string = self.running_mode_str
     return dict(start = last_run_or_heartbeat_from_date_or_none(self.last_start_time),
                 end = last_run_or_heartbeat_from_date_or_none(self.last_end_time),
                 status = self.status,
                 PID = self.process_id,
                 running = run_string
                 )
 def as_printable_list(self):
     run_string = self.running_mode_str
     status_string = f"{''+self.status:<7}"
     process_id_string = f"{''+str(self.process_id):<8}"
     return [
         "Started %s" %
         last_run_or_heartbeat_from_date_or_none(self.last_start_time),
         "ended %s" %
         last_run_or_heartbeat_from_date_or_none(self.last_end_time),
         "Status %s" % status_string,
         "PID %s" % process_id_string, run_string
     ]
Example #3
0
 def send_update_message(self, process_name, current_status, new_status):
     ## Called when anything changes status
     msg = "Status of %s changed from %s to %s at %s" % (
         process_name,
         current_status,
         new_status,
         last_run_or_heartbeat_from_date_or_none(datetime.datetime.now()),
     )
     self.log_messages.append_msg(msg)
def get_control_data_for_single_ordinary_method(data, method_name_and_process):
    method, process_name = method_name_and_process
    data_control = diagControlProcess(data)

    last_start = data_control.when_method_last_started(process_name, method)
    last_start_as_str = last_run_or_heartbeat_from_date_or_none(last_start)

    last_end = data_control.when_method_last_ended(process_name, method)
    last_end_as_str = last_run_or_heartbeat_from_date_or_none(last_end)

    currently_running = data_control.method_currently_running(
        process_name, method)

    data_for_method = dataForMethod(method_or_strategy=method,
                                    process_name=process_name,
                                    last_start=last_start_as_str,
                                    last_end=last_end_as_str,
                                    currently_running=str(currently_running))

    return data_for_method