File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ from parsing_models .application_model_v2 import sparkApplication
2+
3+ import os
4+ import argparse
5+
6+ if __name__ == '__main__' :
7+
8+ parser = argparse .ArgumentParser ()
9+ parser .add_argument ('-d' , help = 'Log file ' )
10+ args = parser .parse_args ()
11+
12+ print ('\n ' + '*' * 12 + ' Running the Log Parser for Spark Predictor' + '*' * 12 + '\n ' )
13+ if args .d == None :
14+ raise Exception ('Must specify log file with -d option' )
15+
16+ logFile = args .d
17+ logFile = os .path .abspath (logFile )
18+
19+
20+
21+ dir_path = os .path .dirname (os .path .realpath (__file__ ))
22+ saveDir = os .path .join (dir_path , 'results' )
23+
24+ if not os .path .isdir (saveDir ):
25+ os .mkdir (saveDir )
26+
27+ print ('\n --Processing log file: ' + logFile )
28+
29+ fileName = logFile .replace ('/' , '.' ).split ('.' )[- 1 ]
30+ savePath = os .path .join (saveDir , 'parsed-' + fileName )
31+
32+ try :
33+ # Save the current result
34+ if os .path .exists (savePath ):
35+ os .remove (savePath )
36+
37+ appobj = sparkApplication (eventlog = logFile )
38+ appobj .save (savePath )
39+
40+ print (f'--Log directory saved to: { savePath } ' )
41+
42+ except Exception as e :
43+ print (e )
Original file line number Diff line number Diff line change 1+ Subproject commit 923d196aaa10783001fa3995fab901f4a7c7bdaf
You can’t perform that action at this time.
0 commit comments