Skip to content

Commit a0e6546

Browse files
author
syncmachineuser
committed
Updated
1 parent c36bef4 commit a0e6546

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

parse.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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)

spark_predictor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 923d196aaa10783001fa3995fab901f4a7c7bdaf

0 commit comments

Comments
 (0)