Skip to content

Commit ca4ee75

Browse files
committed
New Features
1 parent 331de46 commit ca4ee75

File tree

10 files changed

+518
-213
lines changed

10 files changed

+518
-213
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ compile-test/
55
output/
66
configs/
77
logs/
8+
lats/
89
# answer/A1T1
910
# answer/A1T2
1011
*logs.txt

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# BigHOST
22

3+
This is the official repository of BigHOST. BigHOST is an autograding system that is developed to evaluate Big Data Assignments. BigHOST employs a simple architecture that is scalable and provides a fair environment for executing multiple Big Data jobs in parallel.
4+
35
## Citation
46

57
This work has been accepted at _2023 IEEE/ACM 23rd International Symposium on Cluster, Cloud and Internet Computing Workshops (CCGridW)_.

common/email_service.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import os
22
import time
33
import smtplib
4-
from common import dbuser_rr, dbuser_ec
54

5+
from common.db import DataBase
66
from email.mime.text import MIMEText
77
from email.mime.multipart import MIMEMultipart
88

9+
db = DataBase()
10+
dbuser_rr = db.metadata["RR"]["collections"]["users"]
11+
dbuser_ec = db.metadata["EC"]["collections"]["users"]
12+
913
class EmailingService:
1014
@staticmethod
1115
def get_connection(user, password) -> smtplib.SMTP_SSL:

config/evaluator.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
"timeout": 30,
2020
"log_dir": "/home/vishalr/Desktop/backend-2022/executor-logs/",
2121
"log_timeout": 120,
22-
"sys_timeout": 1
22+
"sys_timeout": 1,
23+
"output_processor_threads": 1,
24+
"output_processor_timeout": 30,
25+
"store_lats": true,
26+
"lats_dir": "/home/vishalr/Desktop/backend-2022/lats/"
2327
},
2428

2529
"docker": {
@@ -30,7 +34,7 @@
3034
"cpu_limit": 6,
3135
"taskset": true,
3236
"memory_limit": "8000m",
33-
"shared_output_dir": "/home/vishalramesh01/backend-2022/output/",
37+
"shared_output_dir": "/home/vishalr/Desktop/backend-2022/output/",
3438
"docker_output_dir": "/output",
3539
"docker_memswapiness": 0,
3640
"spawn_wait": 40,

flask_backend/backend.py

+44-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from flask import Flask, request, jsonify
1818
from signal import signal, SIGPIPE, SIG_DFL
1919
from flask_backend.parser import SanityCheckerASTVisitor
20+
from job_tracker.job import MRJob, SparkJob, KafkaJob, job_template_selector
21+
from pprint import pprint
2022

2123
signal(SIGPIPE, SIG_DFL)
2224

@@ -113,12 +115,23 @@ def update_submission(marks, message, data, send_mail=False):
113115
@cross_origin()
114116
def sanity_check():
115117
'''
116-
Currently assuming the assignment to be a MR Job
118+
BigHOST Sanity Checker
117119
'''
120+
118121
jobs = json.loads(request.data)
119122
data = jobs
120123

124+
job_template = job_template_selector(data["assignmentId"])
125+
126+
job = job_template(
127+
team_id=data["teamId"],
128+
assignment_id=data["assignmentId"],
129+
submission_id=data["submissionId"]
130+
)
131+
132+
job.record("received")
121133
update_submission(marks=-1, message='Sanity Checking', data=data)
134+
job.record("sanity_check_start")
122135

123136
compile_path = f"{os.path.join(os.getcwd(),'compile-test', str(data['submissionId']))}"
124137

@@ -127,7 +140,7 @@ def sanity_check():
127140

128141
_ = open(os.path.join(compile_path, "__init__.py"), "w+").close() # required for pylint to work
129142

130-
if "A3" not in data["assignmentId"]:
143+
if "A1" in data["assignmentId"] or "A2" in data["assignmentId"]:
131144
mapper_data = data["mapper"]
132145
reducer_data = data['reducer']
133146
mapper_name = f"{data['teamId']}-{data['assignmentId']}-mapper.py"
@@ -250,10 +263,25 @@ def sanity_check():
250263
update_submission(marks=-1, message='Sanity Check Passed', data=data)
251264

252265
data["timeout"] = get_timeouts(assignment_id=data['assignmentId'])
266+
267+
job.record("sanity_check_end")
268+
269+
if isinstance(job, MRJob):
270+
job.mapper = data["mapper"]
271+
job.reducer = data["reducer"]
272+
elif isinstance(job, SparkJob):
273+
job.spark = data["spark"]
274+
elif isinstance(job, KafkaJob):
275+
job.producer = data["producer"]
276+
job.consumer = data["consumer"]
277+
278+
job.timeout = data["timeout"]
253279

254-
update_submission(marks=-1, message='Queued for Execution', data=data)
280+
update_submission(marks=-1, message='Queued for Execution', data=job.get_db_fields())
255281

256-
data = pickle.dumps(data)
282+
job.record("waiting_queue_entry")
283+
284+
data = pickle.dumps(job)
257285
queue.enqueue(data)
258286

259287
res = {"msg": "Queued", "len": len(queue)}
@@ -280,7 +308,7 @@ def get_jobs():
280308
res = {"msg": "Submission Queue is currently empty.", "len": len(queue), "num_submissions": 0, "status": 200}
281309
return jsonify(res)
282310

283-
data = []
311+
data = {}
284312
i = 0
285313
while i < prefetch_factor:
286314
queue_data = queue.dequeue()
@@ -290,7 +318,9 @@ def get_jobs():
290318

291319
_, serialized_job = queue_data
292320
job = pickle.loads(serialized_job)
293-
data.append(job)
321+
job.record("waiting_queue_exit")
322+
# pprint(job.__dict__)
323+
data[f"job{i+1}"] = job.__dict__
294324
i += 1
295325

296326
length = len(data)
@@ -303,6 +333,7 @@ def get_jobs():
303333
"status": 200,
304334
"jobs": data
305335
}
336+
306337
return jsonify(res)
307338

308339
@app.route("/register_executor", methods=["POST"])
@@ -405,7 +436,13 @@ def executor_log():
405436
if not os.path.exists(executor_log_path):
406437
os.makedirs(executor_log_path)
407438

408-
logs = json.loads(data["logs"])
439+
logs = json.loads(data["worker_logs"])
440+
for logname in logs:
441+
f = open(os.path.join(executor_log_path, logname), "a+")
442+
f.write(logs[logname])
443+
f.close()
444+
445+
logs = json.loads(data["output_processor_logs"])
409446
for logname in logs:
410447
f = open(os.path.join(executor_log_path, logname), "a+")
411448
f.write(logs[logname])

0 commit comments

Comments
 (0)