File indexing completed on 2026-04-11 08:41:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 import logging
0014 logger = logging.getLogger(__name__)
0015
0016 """
0017 Base communicator
0018 """
0019
0020
0021 class BaseCommunicator(object):
0022 _instance = None
0023
0024 def __new__(class_, *args, **kwargs):
0025 if not isinstance(class_._instance, class_):
0026 class_._instance = object.__new__(class_, *args, **kwargs)
0027 return class_._instance
0028
0029 def __init__(self, *args, **kwargs):
0030 super(BaseCommunicator, self).__init__()
0031 for key in kwargs:
0032 setattr(self, key, kwargs[key])
0033
0034 def pre_check_get_jobs(self, req):
0035 """
0036 Precheck whether it's ok to send a requst to get jobs.
0037 """
0038
0039 raise NotImplementedError()
0040
0041 def request_get_jobs(self, req):
0042 """
0043 Send a requst to get jobs.
0044 """
0045 raise NotImplementedError()
0046
0047 def check_get_jobs_status(self, req):
0048 """
0049 Check whether jobs are prepared
0050 """
0051 raise NotImplementedError()
0052
0053 def get_jobs(self, req):
0054 """
0055 Get the job
0056 """
0057 raise NotImplementedError()
0058
0059 def update_jobs(self, req):
0060 """
0061 Update jobs status.
0062 """
0063 raise NotImplementedError()
0064
0065 def pre_check_get_events(self, req):
0066 """
0067 Precheck whether it's ok to send a request to get events.
0068 """
0069 raise NotImplementedError()
0070
0071 def request_get_events(self, req):
0072 """
0073 Send a requst to get events.
0074 """
0075 raise NotImplementedError()
0076
0077 def check_get_events_status(self, req):
0078 """
0079 Check whether events prepared
0080 """
0081 raise NotImplementedError()
0082
0083 def get_events(self, req):
0084 """
0085 Get events
0086 """
0087 raise NotImplementedError()
0088
0089 def pre_check_update_events(self, req):
0090 """
0091 Precheck whether it's ok to update events.
0092 """
0093 raise NotImplementedError()
0094
0095 def update_events(self, req):
0096 """
0097 Update events.
0098 """
0099 raise NotImplementedError()
0100
0101 def pre_check_update_jobs(self, req):
0102 """
0103 Precheck whether it's ok to update event ranges.
0104 """
0105 raise NotImplementedError()