Spaces:
Runtime error
Runtime error
Commit
·
3601b10
1
Parent(s):
f01c786
log
Browse files- Dockerfile +1 -1
- backend/invoke_worker/chapter_queue.py +13 -10
Dockerfile
CHANGED
|
@@ -72,5 +72,5 @@ RUN bash -c 'export HOST=$(cat /secrets/HOST) && \
|
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
-
CMD ["uvicorn", "core.asgi:application", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"
|
| 76 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
+
CMD ["uvicorn", "core.asgi:application", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]
|
| 76 |
|
backend/invoke_worker/chapter_queue.py
CHANGED
|
@@ -98,16 +98,18 @@ class Job(Thread):
|
|
| 98 |
|
| 99 |
job = web_scrap.source_control[source].get_chapter.scrap(comic_id=comic_id,chapter_id=chapter_id,output_dir=input_dir)
|
| 100 |
if job.get("status") == "success":
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
| 111 |
if result.returncode != 0: raise Exception("Image Translator Execution error!")
|
| 112 |
os.makedirs(managed_output_dir,exist_ok=True)
|
| 113 |
shutil.rmtree(input_dir)
|
|
@@ -150,6 +152,7 @@ class Job(Thread):
|
|
| 150 |
}
|
| 151 |
})
|
| 152 |
SocketRequestChapterQueueCache.objects.filter(id=query_result.id).delete()
|
|
|
|
| 153 |
else:
|
| 154 |
input_dir = os.path.join(STORAGE_DIR,source,comic_id,str(chapter_idx),"original")
|
| 155 |
if os.path.exists(input_dir): shutil.rmtree(input_dir)
|
|
|
|
| 98 |
|
| 99 |
job = web_scrap.source_control[source].get_chapter.scrap(comic_id=comic_id,chapter_id=chapter_id,output_dir=input_dir)
|
| 100 |
if job.get("status") == "success":
|
| 101 |
+
with open(os.path.join(LOG_DIR,"image_translator_output.log"), "w") as file:
|
| 102 |
+
result = subprocess.run(
|
| 103 |
+
script,
|
| 104 |
+
cwd=os.path.join(BASE_DIR, "backend", "module", "utils", "image_translator"),
|
| 105 |
+
shell=True,
|
| 106 |
+
check=True,
|
| 107 |
+
stdout=file,
|
| 108 |
+
stderr=file,
|
| 109 |
+
text=True,
|
| 110 |
+
)
|
| 111 |
+
with open(os.path.join(LOG_DIR,"image_translator_output.log"), "r") as file:
|
| 112 |
+
print(file.read())
|
| 113 |
if result.returncode != 0: raise Exception("Image Translator Execution error!")
|
| 114 |
os.makedirs(managed_output_dir,exist_ok=True)
|
| 115 |
shutil.rmtree(input_dir)
|
|
|
|
| 152 |
}
|
| 153 |
})
|
| 154 |
SocketRequestChapterQueueCache.objects.filter(id=query_result.id).delete()
|
| 155 |
+
else: raise Exception("Dowload chapter error!")
|
| 156 |
else:
|
| 157 |
input_dir = os.path.join(STORAGE_DIR,source,comic_id,str(chapter_idx),"original")
|
| 158 |
if os.path.exists(input_dir): shutil.rmtree(input_dir)
|