Skip to content
Snippets Groups Projects
Commit 600395c3 authored by Sebastian Brommer's avatar Sebastian Brommer :hand_splayed_tone4:
Browse files

update prepare script

parent f927b3e9
Branches
No related tags found
No related merge requests found
#!/usr/bin/python3
import os
import sys
import classad
import json
def get_job_ad():
instream = sys.stdin
try:
job_ad = classad.parseOne(instream, parser=classad.Parser.Auto)
except (SyntaxError, ValueError) as e:
print(f"Failed to parse ClassAd: {e}")
return None
job_ad = {}
# format of the job ad is key = value
for line in instream:
if "=" in line:
key, value = line.split(" = ")
job_ad[key.strip()] = value.strip()
return job_ad
......@@ -49,6 +50,10 @@ def check_image_availability(image_path):
def main():
job_ad = get_job_ad()
# write job_ad to a json file for debugging
dumpfilepath = "/scratch/job_ad.json"
with open(dumpfilepath, "w") as f:
json.dump(job_ad, f, indent=4)
container_image = job_ad.get("container_image")
docker_image = job_ad.get("docker_image")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment