summaryrefslogtreecommitdiff
path: root/worker
diff options
context:
space:
mode:
authorBoYanZh <32470225+BoYanZh@users.noreply.github.com>2020-10-02 11:49:18 +0800
committerBoYanZh <32470225+BoYanZh@users.noreply.github.com>2020-10-02 11:49:18 +0800
commitc57929858c82bbf942397b1277311d6d86f2fac9 (patch)
tree3e59e076bb66bfa8058f367815ceb24ff9871168 /worker
parentd81ddbf59fb1ecee6b916e9b0124f50f9405fa96 (diff)
update: JOJ logging
Diffstat (limited to 'worker')
-rw-r--r--worker/JOJWorker.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/worker/JOJWorker.py b/worker/JOJWorker.py
index 9082a47..135a113 100644
--- a/worker/JOJWorker.py
+++ b/worker/JOJWorker.py
@@ -53,7 +53,8 @@ class JOJWorker():
status = soup.select(
"#status > div.section__header > h1 > span:nth-child(2)"
)[0].get_text().strip()
- if status not in ["Waiting", "Compiling", "Pending", "Running"]:
+ if status not in ["Waiting", "Compiling", "Fetched", "Running"]:
+ self.logger.debug(status)
break
else:
time.sleep(1)
@@ -76,21 +77,23 @@ class JOJWorker():
while True:
tryTime += 1
response = self.uploadZip(homeworkID, problemID, zipPath, lang)
- if response.status_code != 200:
- self.logger.error(
- f"{groupName} h{hwNum} {fn} upload error, code {response.status_code}"
- )
- else:
+ if response.status_code == 200:
break
+ self.logger.error(
+ f"{groupName} h{hwNum} {fn} upload error, code {response.status_code}, url {response.url}"
+ )
+ time.sleep(1)
self.logger.debug(
- f"{groupName} h{hwNum} {fn} upload succeed {response.url}")
+ f"{groupName} h{hwNum} {fn} upload succeed, url {response.url}")
return self.getProblemStatus(response.url)
def checkGroupJOJProcess(self, groupNum, hwNum, jojInfo, fn, problemID):
groupName = f"hgroup-{groupNum:02}"
hwDir = os.path.join('hwrepos', groupName, f"h{hwNum}")
filePath = os.path.join(hwDir, fn)
- if not os.path.exists(filePath): return 0
+ if not os.path.exists(filePath):
+ self.logger.warning(f"{groupName} h{hwNum} {fn} not exist")
+ return 0
with zipfile.ZipFile(filePath + ".zip", mode='w') as zf:
zf.write(filePath, fn)
res = self.getProblemResult(jojInfo["homeworkID"], problemID,