-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
47 lines (35 loc) · 1.67 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os, gc, argparse
PARENT_DIR = os.path.dirname(__file__)
from src.utils.filesysutil import checkx509, display_top
from config.projectconfg import dasksetting, runsetting
from config.customEvtSel import switch_selections
def runselections():
gc.enable()
from src.analysis.spawnjobs import JobRunner
parser = argparse.ArgumentParser(
description='''Run event selections for data analysis.
This script performs event selections based on the specified configuration and input file.
It supports optional memory diagnostics to help identify memory usage issues.
Arguments:
- --input: Path to the input file containing data to be processed. See example input files in example/ directory.
- --diagnose: Enable memory diagnostics to track memory usage during execution.
'''
)
parser.add_argument('--input', type=str, help='input file path', default=None)
parser.add_argument('--diagnose', action='store_true', default=False, help='Enable memory diagnose')
args = parser.parse_args()
if args.diagnose:
import tracemalloc
tracemalloc.start()
checkx509()
selectionclass = switch_selections(runsetting.SEL_NAME)
jr = JobRunner(runsetting, args.input, selectionclass, dasksetting)
print("======================================================================")
print("Enter Main Python program: Event selection Mode!")
print("======================================================================")
jr.submitjobs(client=None)
if args.diagnose:
snapshot = tracemalloc.take_snapshot()
display_top(snapshot)
if __name__ == '__main__':
runselections()