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

Class RemoteMongoConnector

python3_cron_scripts/libs3/RemoteMongoConnector.py:22–144  ·  view source on GitHub ↗

This class is designed for interacting with the remote MongoDB. The remote MongoDB lives in AWS and it is where large jobs are processed. It contains mirros of the main Mongo collection for remote processing.

Source from the content-addressed store, hash-verified

20
21
22class RemoteMongoConnector(MongoConnectorBase):
23 """
24 This class is designed for interacting with the remote MongoDB.
25 The remote MongoDB lives in AWS and it is where large jobs are processed.
26 It contains mirros of the main Mongo collection for remote processing.
27 """
28
29 mongo_config_file = "connector.config"
30 m_connection = None
31 _logger = None
32
33 def _log(self):
34 """
35 Get the log
36 """
37 return logging.getLogger(__name__)
38
39 def __init__(self, config_file="", log_level=None):
40 """
41 Initialize the instance
42 """
43 self._logger = self._log()
44
45 if log_level is not None:
46 self._logger.setLevel(log_level)
47
48 if config_file != "":
49 self.mongo_config_file = config_file
50
51 m_base = MongoConnectorBase(config_file, "RemoteMongoDB", log_level)
52 self.m_connection = m_base.m_connection
53
54 def get_results_connection(self):
55 """Returns a connection to the results collection in MongoDB"""
56 return self.m_connection.results
57
58 def get_zone_connection(self):
59 """Returns a connection to the zones collection in MongoDB"""
60 return self.m_connection.zones
61
62 def get_ipzone_connection(self):
63 """Returns a connection to the ip_zones collection in MongoDB"""
64 return self.m_connection.ip_zones
65
66 def get_ipv6_zone_connection(self):
67 """Returns a connection to the ipv6_zones collection in MongoDB"""
68 return self.m_connection.ipv6_zones
69
70 def get_config_connection(self):
71 """Returns a connection to the config collection in MongoDB"""
72 return self.m_connection.config
73
74 def get_jobs_connection(self):
75 """Returns a connection to the jobs collection in MongoDB"""
76 return self.m_connection.jobs
77
78 def get_aws_ips_connection(self):
79 """Returns a connection to the aws_ips collection in MongoDB"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected