Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
XaverStiensmeier committed Dec 11, 2023
1 parent bb4a24c commit 234dab3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
logging.info("delete_server.py started")
start_time = time.time()

logging.info(f"Terminate parameter: {sys.argv[1]}")

if len(sys.argv) < 2:
logging.warning("usage: $0 instance1_name[,instance2_name,...]")
logging.info("Your input %s with length %s", sys.argv, len(sys.argv))
sys.exit(1)

terminate_workers = sys.argv[1].split("\n")
logging.info("Deleting instances %s", terminate_workers)

Expand Down Expand Up @@ -61,7 +64,8 @@
logging.warning(f"Couldn't delete worker {terminate_worker}")
else:
logging.info(f"Deleted {terminate_worker}")
logging.info("Successful delete_server.py execution!")

logging.info(f"Successful delete_server.py execution ({sys.argv[1]})!")
time_in_s = time.time() - start_time
logging.info("--- %s minutes and %s seconds ---", math.floor(time_in_s / 60), time_in_s % 60)
logging.info("Exit Code 0")
Expand Down
4 changes: 4 additions & 0 deletions resources/playbook/roles/bibigrid/files/slurm/fail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ scontrol update NodeName="$1" state=RESUME reason=FailedStartup # no sudo needed

hosts=$(scontrol show hostnames "$1")

echo "Hosts $hosts used"

# delete servers
python3 /usr/local/bin/delete_server.py "${hosts}"

echo "Finished delete_server.py execution."

exit $?

0 comments on commit 234dab3

Please sign in to comment.