improved workflow delete check and delete folder

pull/808/head
Jingyi 2024-06-11 12:04:16 +08:00
parent 55c46bf2c3
commit 573ed850b8
2 changed files with 21 additions and 2 deletions

View File

@ -1059,6 +1059,24 @@ if is_on_ec2:
return web.Response(status=200, content_type='application/json',
body=json.dumps({"result": False, "message": "can not delete current workflow"}))
i = 0
start_n = 10000
while i < 30:
port = start_n + i
file_path = f"/container/comfy_{port}"
i = i + 1
if os.path.exists(file_path):
with open(file_path, 'r') as f:
content = f.read()
content = content.strip()
if content == name:
return web.Response(status=200, content_type='application/json',
body=json.dumps({"result": False,
"message": f"can not delete workflow "
f"because it is in use by {port}"}))
os.system(f"rm -rf /container/workflows/{name}")
data = {
"workflow_name_list": [name],
}
@ -1098,7 +1116,8 @@ if is_on_ec2:
if workflow_name == 'default' and not is_master_process:
return web.Response(status=200, content_type='application/json',
body=json.dumps({"result": False, "message": "slave can not use default workflow"}))
body=json.dumps({"result": False, "message": "slave can not use default workflow "
"after initial"}))
if workflow_name != 'default':
if not check_workflow_exists(workflow_name):

View File

@ -18,7 +18,7 @@ while true; do
if [ "$current_image" = "$image_target_name" ]; then
echo "$current_image already pushed"
sleep 10
sleep 30
continue
fi
current_image=$image_target_name