MCPcopy Create free account
hub / github.com/adobe/Marinus / JobsManager

Class JobsManager

python3_cron_scripts/libs3/JobsManager.py:17–133  ·  view source on GitHub ↗

The jobs collection is responsible for tracking the progress of the various scripts. This class is responsible for recording the status of jobs within the jobs collection.

Source from the content-addressed store, hash-verified

15
16
17class JobsManager(object):
18 """
19 The jobs collection is responsible for tracking the progress of the various scripts.
20 This class is responsible for recording the status of jobs within the jobs collection.
21 """
22
23 # Job states
24 ##################
25
26 # Never been run
27 NOT_RUN = "NOT_RUN"
28
29 # In progress
30 RUNNING = "RUNNING"
31
32 # Ready for next phase
33 READY = "READY"
34
35 # An error has occurred
36 ERROR = "ERROR"
37
38 # The job is complete
39 COMPLETE = "COMPLETE"
40
41 # The job is no longer used
42 RETIRED = "RETIRED"
43
44 # Settings
45 ###################
46
47 # Print debug output
48 _logger = None
49
50 # JobsCollection
51 _jobs_collection = None
52
53 # Mongo_Connector
54 _mongo_connector = None
55
56 # Job Name
57 _job_name = ""
58
59 def _log(self):
60 """
61 Get the log
62 """
63 return logging.getLogger(__name__)
64
65 def __init__(self, mongo_connector, job_name, log_level=None):
66 self._logger = self._log()
67 if log_level is not None:
68 self._logger.setLevel(log_level)
69
70 self._mongo_connector = mongo_connector
71 self._jobs_collection = mongo_connector.get_jobs_connection()
72 self._job_name = job_name
73
74 def __check_job_exists(self, job_name):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected