Skip to content
Snippets Groups Projects

update a4f for compatibility with Donnie/Oniro4OpenHarmony

Open Alberto Pianon requested to merge ap/donnie into master
Files
5
@@ -190,33 +190,41 @@ class FossyWrapper:
+ res.text
)
upload_id = res.json()["message"]
sleep(30)
res = self.fossology.session.get(
f"{self.fossology.api}/jobs/history?upload={upload_id}"
)
jobs = res.json()
for j in jobs:
for jq in j["jobQueue"]:
if jq["jobQueueType"] == "ununpack" and jq["status"] == "Failed":
ununpack_failed = True
break
else:
ununpack_failed = False
if ununpack_failed:
retry = 0
while True:
res = self.fossology.session.get(
f"{self.fossology.api}/jobs/history?upload={upload_id}"
)
jobs = res.json()
for j in jobs:
for jq in j["jobQueue"]:
if jq["jobQueueType"] == "ununpack":
ununpack_status = jq["status"]
break
if ununpack_status in [ "Completed", "Failed" ]:
break
if not ununpack_failed:
retry += 1
if ununpack_status == "Started" and retry > 600:
raise FossyWrapperException(
"Ununpack job did not finish after 10h")
elif ununpack_status == None and retry > 120:
raise FossyWrapperException(
"Ununpack job did not started after 2h")
sleep(60)
if ununpack_status == "Completed":
break
logger.info("Ununpack failed, restarting scheduler and trying again")
logger.info(
"Ununpack failed, restarting scheduler and trying again")
self.restart_fossology_server()
try:
upload = self.fossology.detail_upload(upload_id, wait_time=60*4)
logger.info(f"upload id is {upload.id}")
return upload
except RetryError:
raise FossyWrapperException(
"Can't upload package to fossology. Is fossology scheduler running?"
)
logger.info(f"upload id is {upload.id}")
return upload
def rename_upload(self, upload: Upload, newuploadname: str) -> None:
self.fossyUI_login()
@@ -404,7 +412,7 @@ class FossyWrapper:
def restart_fossology_server(self):
res = self.fossology.session.post(
self.fossology.api + "/jobs/scheduler/operation/run?job=scheduler",
data={"operation": "restarts"}
data={"operation": "restart"}
)
# NOTE: for this to work, you need to uncomment the corresponding
# functionality in Fossology, and to set up a workaround to allow
Loading