wwpdb.apps.val-rel 0.27.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wwpdb/apps/val_rel/PopulateValidateRelease.py +311 -0
- wwpdb/apps/val_rel/RemoveExcessOutputFolders.py +92 -0
- wwpdb/apps/val_rel/ValidateRelease.py +740 -0
- wwpdb/apps/val_rel/__init__.py +1 -0
- wwpdb/apps/val_rel/config/ValConfig.py +124 -0
- wwpdb/apps/val_rel/config/__init__.py +0 -0
- wwpdb/apps/val_rel/service/ValidationReleaseServiceHandler.py +345 -0
- wwpdb/apps/val_rel/service/__init__.py +0 -0
- wwpdb/apps/val_rel/utils/CutOffUtils.py +32 -0
- wwpdb/apps/val_rel/utils/Files.py +72 -0
- wwpdb/apps/val_rel/utils/FindAndProcessEntries.py +220 -0
- wwpdb/apps/val_rel/utils/FindEntries.py +70 -0
- wwpdb/apps/val_rel/utils/PersistFileCache.py +192 -0
- wwpdb/apps/val_rel/utils/ValDataStore.py +40 -0
- wwpdb/apps/val_rel/utils/ValidationRun.py +112 -0
- wwpdb/apps/val_rel/utils/XmlInfo.py +21 -0
- wwpdb/apps/val_rel/utils/__init__.py +0 -0
- wwpdb/apps/val_rel/utils/checkModifications.py +25 -0
- wwpdb/apps/val_rel/utils/check_results.py +386 -0
- wwpdb/apps/val_rel/utils/emailHandler.py +77 -0
- wwpdb/apps/val_rel/utils/fileConversion.py +32 -0
- wwpdb/apps/val_rel/utils/find_and_run_missing.py +100 -0
- wwpdb/apps/val_rel/utils/ftp_protocol/getFilesReleaseFTP_EMDB.py +251 -0
- wwpdb/apps/val_rel/utils/ftp_protocol/getFilesReleaseFTP_PDB.py +193 -0
- wwpdb/apps/val_rel/utils/ftp_protocol/getRemoteFilesFTP.py +309 -0
- wwpdb/apps/val_rel/utils/getFilesRelease.py +178 -0
- wwpdb/apps/val_rel/utils/getFilesReleaseBase.py +116 -0
- wwpdb/apps/val_rel/utils/getFilesReleaseOneDep.py +143 -0
- wwpdb/apps/val_rel/utils/http_protocol/__init__.py +0 -0
- wwpdb/apps/val_rel/utils/http_protocol/getFilesReleaseHTTP_EMDB.py +277 -0
- wwpdb/apps/val_rel/utils/http_protocol/getFilesReleaseHTTP_PDB.py +192 -0
- wwpdb/apps/val_rel/utils/http_protocol/getRemoteFilesHTTP.py +200 -0
- wwpdb/apps/val_rel/utils/mmCIFInfo.py +264 -0
- wwpdb/apps/val_rel/utils/outputFiles.py +246 -0
- wwpdb_apps_val_rel-0.27.dev1.dist-info/METADATA +185 -0
- wwpdb_apps_val_rel-0.27.dev1.dist-info/RECORD +37 -0
- wwpdb_apps_val_rel-0.27.dev1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import json
|
|
3
|
+
import logging
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
from typing import Dict, List, Optional, Union
|
|
7
|
+
|
|
8
|
+
from wwpdb.utils.config.ConfigInfo import getSiteId
|
|
9
|
+
from wwpdb.utils.message_queue.MessagePublisher import MessagePublisher
|
|
10
|
+
|
|
11
|
+
from wwpdb.apps.val_rel.config.ValConfig import ValConfig
|
|
12
|
+
from wwpdb.apps.val_rel.utils.FindAndProcessEntries import FindAndProcessEntries
|
|
13
|
+
from wwpdb.apps.val_rel.utils.FindEntries import FindEntries
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PopulateValidateRelease:
|
|
19
|
+
def __init__(
|
|
20
|
+
self,
|
|
21
|
+
entry_string: str = "",
|
|
22
|
+
entry_list: Optional[List[str]] = None,
|
|
23
|
+
entry_file: str = "",
|
|
24
|
+
keep_logs: bool = False,
|
|
25
|
+
output_root: Optional[str] = None,
|
|
26
|
+
always_recalculate: bool = False,
|
|
27
|
+
skip_gzip: bool = False,
|
|
28
|
+
skip_emdb: bool = False,
|
|
29
|
+
validation_sub_dir: str = "current",
|
|
30
|
+
pdb_release: bool = False,
|
|
31
|
+
emdb_release: bool = False,
|
|
32
|
+
site_id: Optional[str] = None,
|
|
33
|
+
nocache: bool = False,
|
|
34
|
+
priority: bool = False,
|
|
35
|
+
subscribe: Optional[str] = None,
|
|
36
|
+
) -> None:
|
|
37
|
+
if site_id is None:
|
|
38
|
+
site_id = getSiteId()
|
|
39
|
+
if entry_list is None:
|
|
40
|
+
entry_list = []
|
|
41
|
+
self.__entry_list = entry_list
|
|
42
|
+
self.__entry_string = entry_string
|
|
43
|
+
self.__entry_file = entry_file
|
|
44
|
+
self.__site_id = site_id
|
|
45
|
+
self.__messages: List[Dict[str, Union[Optional[str], bool]]] = []
|
|
46
|
+
self.__pdb_release = pdb_release
|
|
47
|
+
self.__emdb_release = emdb_release
|
|
48
|
+
self.__keep_logs = keep_logs
|
|
49
|
+
self.__output_root = output_root
|
|
50
|
+
self.__always_recalculate = always_recalculate
|
|
51
|
+
self.__skipGzip = skip_gzip
|
|
52
|
+
self.__skip_emdb = skip_emdb
|
|
53
|
+
self.__validation_sub_dir = validation_sub_dir
|
|
54
|
+
self.__priority_queue = priority
|
|
55
|
+
self.__subscribe = subscribe
|
|
56
|
+
if self.__priority_queue and self.__subscribe:
|
|
57
|
+
logger.critical("error - mixing of priority queues and subscriber queues")
|
|
58
|
+
sys.exit()
|
|
59
|
+
self.__nocache = nocache
|
|
60
|
+
# priority queues
|
|
61
|
+
if self.__priority_queue:
|
|
62
|
+
self.make_priorities()
|
|
63
|
+
|
|
64
|
+
def find_and_process_entries(self) -> None:
|
|
65
|
+
fape = FindAndProcessEntries(
|
|
66
|
+
entry_string=self.__entry_string,
|
|
67
|
+
entry_file=self.__entry_file,
|
|
68
|
+
entry_list=self.__entry_list,
|
|
69
|
+
skip_emdb=self.__skip_emdb,
|
|
70
|
+
pdb_release=self.__pdb_release,
|
|
71
|
+
emdb_release=self.__emdb_release,
|
|
72
|
+
site_id=self.__site_id,
|
|
73
|
+
nocache=self.__nocache,
|
|
74
|
+
)
|
|
75
|
+
fape.run_process()
|
|
76
|
+
self.__messages = fape.get_found_entries()
|
|
77
|
+
|
|
78
|
+
def run_process(self) -> None:
|
|
79
|
+
self.find_and_process_entries()
|
|
80
|
+
self.process_messages()
|
|
81
|
+
|
|
82
|
+
def make_priorities(self) -> None:
|
|
83
|
+
fe = FindEntries(siteID=self.__site_id)
|
|
84
|
+
# build lists of absolute input file paths and associated entries
|
|
85
|
+
self.modified_priority_paths = fe.get_modified_pdb_paths()
|
|
86
|
+
self.modified_priorities = [os.path.basename(path) for path in self.modified_priority_paths]
|
|
87
|
+
self.__added_priority_paths = fe.get_added_pdb_paths()
|
|
88
|
+
self.__added_priorities = [os.path.basename(path) for path in self.__added_priority_paths]
|
|
89
|
+
self.__emdb_priority_paths = fe.get_emdb_paths()
|
|
90
|
+
self.__emdb_priorities = [os.path.basename(path) for path in self.__emdb_priority_paths]
|
|
91
|
+
|
|
92
|
+
def get_priority(self, message: Dict[str, Union[Optional[str], bool]]) -> int:
|
|
93
|
+
# missing - 10
|
|
94
|
+
# new pdb - 8
|
|
95
|
+
# new emdb - 6
|
|
96
|
+
# modified pdb - 4
|
|
97
|
+
# modified emdb - 2
|
|
98
|
+
# default - 1
|
|
99
|
+
priority = 1
|
|
100
|
+
if self.__validation_sub_dir and self.__validation_sub_dir == "missing":
|
|
101
|
+
# find_and_run_missing always runs Populate with validation_sub_dir = missing
|
|
102
|
+
priority = 10
|
|
103
|
+
else:
|
|
104
|
+
emd = "emdbID" in message
|
|
105
|
+
pdb = "pdbID" in message
|
|
106
|
+
if not emd and not pdb:
|
|
107
|
+
logger.warning("error - neither pdb or emdb %s", message)
|
|
108
|
+
return 1
|
|
109
|
+
if emd and pdb:
|
|
110
|
+
logger.warning("error - both pdb and emdb %s", message)
|
|
111
|
+
pdb = False
|
|
112
|
+
emd = True
|
|
113
|
+
modified = None
|
|
114
|
+
if self.__always_recalculate or (pdb and message["pdbID"] in self.modified_priorities):
|
|
115
|
+
modified = True
|
|
116
|
+
elif pdb and message["pdbID"] in self.__added_priorities:
|
|
117
|
+
modified = False
|
|
118
|
+
elif emd and message["emdbID"] in self.__emdb_priorities:
|
|
119
|
+
path = None
|
|
120
|
+
for p in self.__emdb_priority_paths:
|
|
121
|
+
if os.path.basename(p) == message["emdbID"]:
|
|
122
|
+
path = p
|
|
123
|
+
break
|
|
124
|
+
if path:
|
|
125
|
+
map_dir = os.path.join(path, "map")
|
|
126
|
+
if os.path.exists(map_dir):
|
|
127
|
+
modified = False
|
|
128
|
+
else:
|
|
129
|
+
modified = True
|
|
130
|
+
if modified is None:
|
|
131
|
+
logger.warning("error - could not get priority for %s", message)
|
|
132
|
+
return 1
|
|
133
|
+
if pdb and not modified:
|
|
134
|
+
priority = 8
|
|
135
|
+
elif emd and not modified:
|
|
136
|
+
priority = 6
|
|
137
|
+
elif pdb and modified:
|
|
138
|
+
priority = 4
|
|
139
|
+
elif emd and modified:
|
|
140
|
+
priority = 2
|
|
141
|
+
return priority
|
|
142
|
+
|
|
143
|
+
def process_messages(self) -> None:
|
|
144
|
+
if self.__messages:
|
|
145
|
+
# Set logging for pika to be lower
|
|
146
|
+
plogging = logging.getLogger("pika")
|
|
147
|
+
plogging.setLevel(logging.ERROR)
|
|
148
|
+
for message in self.__messages:
|
|
149
|
+
if self.__priority_queue:
|
|
150
|
+
priority = self.get_priority(message)
|
|
151
|
+
message["siteID"] = self.__site_id
|
|
152
|
+
message["keepLog"] = self.__keep_logs
|
|
153
|
+
message["subfolder"] = self.__validation_sub_dir
|
|
154
|
+
if self.__nocache:
|
|
155
|
+
message["nocache"] = self.__nocache
|
|
156
|
+
if self.__output_root:
|
|
157
|
+
message["outputRoot"] = self.__output_root
|
|
158
|
+
if self.__always_recalculate:
|
|
159
|
+
message["alwaysRecalculate"] = self.__always_recalculate
|
|
160
|
+
if self.__skipGzip:
|
|
161
|
+
message["skipGzip"] = self.__skipGzip
|
|
162
|
+
if self.__skip_emdb:
|
|
163
|
+
message["skip_emdb"] = self.__skip_emdb
|
|
164
|
+
logger.info("MESSAGE req %s", message)
|
|
165
|
+
vc = ValConfig(self.__site_id)
|
|
166
|
+
if self.__priority_queue:
|
|
167
|
+
ok = MessagePublisher().publish(
|
|
168
|
+
message=json.dumps(message),
|
|
169
|
+
exchangeName=vc.exchange,
|
|
170
|
+
queueName=vc.queue_name,
|
|
171
|
+
routingKey=vc.routing_key,
|
|
172
|
+
priority=priority,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
elif self.__subscribe:
|
|
176
|
+
ok = MessagePublisher().publishDirect(
|
|
177
|
+
message=json.dumps(message),
|
|
178
|
+
exchangeName=self.__subscribe,
|
|
179
|
+
)
|
|
180
|
+
else:
|
|
181
|
+
ok = MessagePublisher().publish(
|
|
182
|
+
message=json.dumps(message),
|
|
183
|
+
exchangeName=vc.exchange,
|
|
184
|
+
queueName=vc.queue_name,
|
|
185
|
+
routingKey=vc.routing_key,
|
|
186
|
+
)
|
|
187
|
+
if self.__priority_queue:
|
|
188
|
+
logger.info("MESSAGE %s PRIORITY %s", ok, priority)
|
|
189
|
+
else:
|
|
190
|
+
logger.info("MESSAGE %s", ok)
|
|
191
|
+
if not ok:
|
|
192
|
+
logger.critical("error - could not publish")
|
|
193
|
+
break
|
|
194
|
+
|
|
195
|
+
def test(self) -> None:
|
|
196
|
+
message: Dict[str, Union[Optional[str], bool]]
|
|
197
|
+
|
|
198
|
+
if not self.__priority_queue:
|
|
199
|
+
logger.info("error - not a priority queue")
|
|
200
|
+
return
|
|
201
|
+
fape = FindAndProcessEntries(
|
|
202
|
+
entry_string=self.__entry_string,
|
|
203
|
+
entry_file=self.__entry_file,
|
|
204
|
+
entry_list=self.__entry_list,
|
|
205
|
+
skip_emdb=self.__skip_emdb,
|
|
206
|
+
pdb_release=self.__pdb_release,
|
|
207
|
+
emdb_release=self.__emdb_release,
|
|
208
|
+
site_id=self.__site_id,
|
|
209
|
+
nocache=self.__nocache,
|
|
210
|
+
)
|
|
211
|
+
fape.find_onedep_entries()
|
|
212
|
+
fape.process_pdb_entries()
|
|
213
|
+
fape.process_emdb_entries()
|
|
214
|
+
if self.__emdb_release:
|
|
215
|
+
for emdb_entry in fape.get_emdb_entries():
|
|
216
|
+
if emdb_entry not in fape.get_added_entries():
|
|
217
|
+
message = {"pdbID": emdb_entry}
|
|
218
|
+
fape.add_message(message)
|
|
219
|
+
fape.add_entry(emdb_entry)
|
|
220
|
+
self.__messages = fape.get_found_entries()
|
|
221
|
+
if self.__messages:
|
|
222
|
+
for message in self.__messages:
|
|
223
|
+
priority = self.get_priority(message)
|
|
224
|
+
message["siteID"] = self.__site_id
|
|
225
|
+
message["keepLog"] = self.__keep_logs
|
|
226
|
+
message["subfolder"] = self.__validation_sub_dir
|
|
227
|
+
if self.__nocache:
|
|
228
|
+
message["nocache"] = self.__nocache
|
|
229
|
+
if self.__output_root:
|
|
230
|
+
message["outputRoot"] = self.__output_root
|
|
231
|
+
if self.__always_recalculate:
|
|
232
|
+
message["alwaysRecalculate"] = self.__always_recalculate
|
|
233
|
+
if self.__skipGzip:
|
|
234
|
+
message["skipGzip"] = self.__skipGzip
|
|
235
|
+
if self.__skip_emdb:
|
|
236
|
+
message["skip_emdb"] = self.__skip_emdb
|
|
237
|
+
logger.info("priority %s msg %s", priority, message)
|
|
238
|
+
vc = ValConfig(self.__site_id)
|
|
239
|
+
logger.info("exchangeName %s queueName %s routingKey %s", vc.exchange, vc.queue_name, vc.routing_key)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def main() -> None:
|
|
243
|
+
# Create logger -
|
|
244
|
+
logger = logging.getLogger() # pylint: disable=redefined-outer-name
|
|
245
|
+
FORMAT = "[%(asctime)s %(levelname)s]-%(module)s.%(funcName)s: %(message)s"
|
|
246
|
+
logging.basicConfig(format=FORMAT)
|
|
247
|
+
|
|
248
|
+
parser = argparse.ArgumentParser()
|
|
249
|
+
parser.add_argument(
|
|
250
|
+
"-d",
|
|
251
|
+
"--debug",
|
|
252
|
+
help="debugging",
|
|
253
|
+
action="store_const",
|
|
254
|
+
dest="loglevel",
|
|
255
|
+
const=logging.DEBUG,
|
|
256
|
+
default=logging.INFO,
|
|
257
|
+
)
|
|
258
|
+
parser.add_argument("--entry_list", help="comma separated list of entries", type=str)
|
|
259
|
+
parser.add_argument("--entry_file", help="file containing list of entries - one per line", type=str)
|
|
260
|
+
parser.add_argument("--pdb_release", help="run PDB entries scheduled for release", action="store_true")
|
|
261
|
+
parser.add_argument("--emdb_release", help="run EMDB entries scheduled for release", action="store_true")
|
|
262
|
+
parser.add_argument("--keep_logs", help="Keep the log files", action="store_true")
|
|
263
|
+
parser.add_argument("--always_recalculate", help="always recalculate", action="store_true")
|
|
264
|
+
parser.add_argument("--skipGzip", help="skip gizpping output files", action="store_true")
|
|
265
|
+
parser.add_argument("--skip_emdb", help="skip emdb validation report calculation", action="store_true")
|
|
266
|
+
parser.add_argument("--siteID", help="siteID", type=str, default=getSiteId())
|
|
267
|
+
parser.add_argument("--python_siteID", help="siteID for the OneDep code", type=str)
|
|
268
|
+
parser.add_argument("--validation_subdir", help="validation sub directory", type=str, default="current")
|
|
269
|
+
parser.add_argument(
|
|
270
|
+
"--output_root",
|
|
271
|
+
help="Folder to output the results to - overrides default OneDep folders",
|
|
272
|
+
type=str,
|
|
273
|
+
)
|
|
274
|
+
parser.add_argument("--nocache", help="Do not use the FTP cache", action="store_true")
|
|
275
|
+
parser.add_argument("--test", help="Testing priority values", action="store_true")
|
|
276
|
+
parser.add_argument("--priority", help="Make a priority queue", action="store_true")
|
|
277
|
+
parser.add_argument(
|
|
278
|
+
"--subscribe",
|
|
279
|
+
help="Exchange name for optional subscriber rather than standard consumer",
|
|
280
|
+
type=str,
|
|
281
|
+
default=None,
|
|
282
|
+
)
|
|
283
|
+
args = parser.parse_args()
|
|
284
|
+
logger.setLevel(args.loglevel)
|
|
285
|
+
|
|
286
|
+
pvr = PopulateValidateRelease(
|
|
287
|
+
entry_string=args.entry_list,
|
|
288
|
+
entry_file=args.entry_file,
|
|
289
|
+
pdb_release=args.pdb_release,
|
|
290
|
+
emdb_release=args.emdb_release,
|
|
291
|
+
site_id=args.siteID,
|
|
292
|
+
keep_logs=args.keep_logs,
|
|
293
|
+
always_recalculate=args.always_recalculate,
|
|
294
|
+
skip_gzip=args.skipGzip,
|
|
295
|
+
skip_emdb=args.skip_emdb,
|
|
296
|
+
validation_sub_dir=args.validation_subdir,
|
|
297
|
+
output_root=args.output_root,
|
|
298
|
+
nocache=args.nocache,
|
|
299
|
+
priority=args.priority,
|
|
300
|
+
subscribe=args.subscribe,
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
if not args.test:
|
|
304
|
+
pvr.run_process()
|
|
305
|
+
elif args.test:
|
|
306
|
+
logger.info("running unit test")
|
|
307
|
+
pvr.test()
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
if "__main__" in __name__:
|
|
311
|
+
main()
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
from typing import List, Optional, Set
|
|
6
|
+
|
|
7
|
+
from wwpdb.utils.config.ConfigInfo import getSiteId
|
|
8
|
+
|
|
9
|
+
from wwpdb.apps.val_rel.utils.FindAndProcessEntries import FindAndProcessEntries
|
|
10
|
+
from wwpdb.apps.val_rel.utils.outputFiles import outputFiles
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FindExcessEntries:
|
|
16
|
+
def __init__(self, site_id: Optional[str] = None, dry_run: bool = False) -> None:
|
|
17
|
+
if site_id is None:
|
|
18
|
+
site_id = getSiteId()
|
|
19
|
+
self.__site_id = site_id
|
|
20
|
+
self.__dry_run = dry_run
|
|
21
|
+
self.__pdb_entries: Set[str] = set()
|
|
22
|
+
self.__output_pdb_entries: List[str] = []
|
|
23
|
+
|
|
24
|
+
def run_process(self) -> None:
|
|
25
|
+
self.find_pdb_and_emdb_entries()
|
|
26
|
+
self.find_pdb_output_entries()
|
|
27
|
+
# self.find_emdb_output_entries()
|
|
28
|
+
self.check_pdb_entries_output_should_exist()
|
|
29
|
+
|
|
30
|
+
def find_pdb_and_emdb_entries(self) -> None:
|
|
31
|
+
pvr = FindAndProcessEntries(
|
|
32
|
+
pdb_release=True,
|
|
33
|
+
emdb_release=True,
|
|
34
|
+
site_id=self.__site_id,
|
|
35
|
+
)
|
|
36
|
+
pvr.find_onedep_entries()
|
|
37
|
+
pvr.process_emdb_entries()
|
|
38
|
+
pvr.process_pdb_entries()
|
|
39
|
+
self.__pdb_entries = pvr.get_all_pdb_entries()
|
|
40
|
+
|
|
41
|
+
# self.__emdb_entries = pvr.get_emdb_entries()
|
|
42
|
+
|
|
43
|
+
def get_pdb_output_folder(self) -> str:
|
|
44
|
+
return outputFiles(siteID=self.__site_id).get_pdb_root_folder()
|
|
45
|
+
|
|
46
|
+
def get_emdb_output_folder(self) -> str:
|
|
47
|
+
return outputFiles(siteID=self.__site_id).get_emdb_root_folder()
|
|
48
|
+
|
|
49
|
+
def find_pdb_output_entries(self) -> None:
|
|
50
|
+
self.__output_pdb_entries = os.listdir(self.get_pdb_output_folder())
|
|
51
|
+
|
|
52
|
+
# def find_emdb_output_entries(self) -> None:
|
|
53
|
+
# self.__output_emdb_entries = os.listdir(self.get_emdb_output_folder())
|
|
54
|
+
|
|
55
|
+
def check_pdb_entries_output_should_exist(self) -> None:
|
|
56
|
+
for entry in self.__output_pdb_entries:
|
|
57
|
+
logger.info(entry)
|
|
58
|
+
if entry not in self.__pdb_entries:
|
|
59
|
+
logger.info("%s should be removed", entry)
|
|
60
|
+
path_to_remove = os.path.join(self.get_pdb_output_folder(), entry)
|
|
61
|
+
logger.info("%s being removed", path_to_remove)
|
|
62
|
+
if not self.__dry_run:
|
|
63
|
+
shutil.rmtree(path_to_remove, ignore_errors=True)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def main() -> None:
|
|
67
|
+
# Create logger -
|
|
68
|
+
FORMAT = "[%(asctime)s %(levelname)s]-%(module)s.%(funcName)s: %(message)s"
|
|
69
|
+
logging.basicConfig(format=FORMAT)
|
|
70
|
+
logger.setLevel(logging.DEBUG)
|
|
71
|
+
|
|
72
|
+
parser = argparse.ArgumentParser()
|
|
73
|
+
parser.add_argument(
|
|
74
|
+
"-d",
|
|
75
|
+
"--debug",
|
|
76
|
+
help="debugging",
|
|
77
|
+
action="store_const",
|
|
78
|
+
dest="loglevel",
|
|
79
|
+
const=logging.DEBUG,
|
|
80
|
+
default=logging.INFO,
|
|
81
|
+
)
|
|
82
|
+
parser.add_argument("--siteID", help="siteID", type=str, default=getSiteId())
|
|
83
|
+
parser.add_argument("--dry_run", help="do a dry run", action="store_true")
|
|
84
|
+
args = parser.parse_args()
|
|
85
|
+
logger.setLevel(args.loglevel)
|
|
86
|
+
|
|
87
|
+
fee = FindExcessEntries(site_id=args.siteID, dry_run=args.dry_run)
|
|
88
|
+
fee.run_process()
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if "__main__" in __name__:
|
|
92
|
+
main()
|