Skip to content

Commit

Permalink
Fix check_task_flag
Browse files Browse the repository at this point in the history
os.exit raises an SystemExit exception, should not call it in a generic
try except block.
  • Loading branch information
ranlu committed Dec 1, 2023
1 parent 7807553 commit 8e87ffc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/check_task_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

TASK_KEY = sys.argv[1]

done = False
try:
r = redis.Redis(host=os.environ["REDIS_SERVER"], db=int(os.environ["REDIS_DB"]))
if r.exists(TASK_KEY) and r.get(TASK_KEY).decode() == "DONE":
sys.exit(0)
else:
sys.exit(1)
done = True
except:
cf = CloudFiles(os.environ["SCRATCH_PATH"])
if cf.exists(f"done/{TASK_KEY}.txt"):
sys.exit(0)
else:
sys.exit(1)
done = True

if not done:
sys.exit(1)

0 comments on commit 8e87ffc

Please sign in to comment.