Skip to content

Commit

Permalink
Remove debug printing
Browse files Browse the repository at this point in the history
  • Loading branch information
ttedeschi authored May 28, 2024
1 parent f2d2fff commit ca69b73
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def mountConfigMaps(pod, container_standalone):
if vol["name"] != mountSpec["name"]:
continue
if "configMap" in vol.keys():
print("container_standaolone:", container_standalone)
print("container_standalone:", container_standalone)
cfgMaps = container_standalone["configMaps"]
for cfgMap in cfgMaps:
podConfigMapDir = os.path.join(
Expand Down Expand Up @@ -343,7 +343,7 @@ def produce_htcondor_singularity_script(containers, metadata, commands, input_fi
Queue 1
"""
print(job)
#print(job)
with open(sub_path, "w") as f_:
f_.write(job)
os.chmod(executable_path, 0o0777)
Expand Down Expand Up @@ -386,7 +386,7 @@ def produce_htcondor_host_script(container, metadata):
Queue 1
"""
print(job)
#print(job)
with open(sub_path, "w") as f_:
f_.write(job)
os.chmod(executable_path, 0o0777)
Expand Down Expand Up @@ -445,11 +445,11 @@ def SubmitHandler():
# READ THE REQUEST ###############
logging.info("HTCondor Sidecar: received Submit call")
request_data_string = request.data.decode("utf-8")
print("Decoded", request_data_string)
#print("Decoded", request_data_string)
req = json.loads(request_data_string)[0]
if req is None or not isinstance(req, dict):
logging.error("Invalid request data for submitting")
print("Invalid submit request body is: ", req)
#print("Invalid submit request body is: ", req)
return "Invalid request data for submitting", 400

# ELABORATE RESPONSE ###########
Expand Down Expand Up @@ -524,20 +524,20 @@ def SubmitHandler():
)
else:
singularity_command = commstr1 + envs + local_mounts + [image]
print("singularity_command:", singularity_command)
#print("singularity_command:", singularity_command)
singularity_commands.append(singularity_command)
path = produce_htcondor_singularity_script(
containers, metadata, singularity_commands, input_files
)

else:
print("host keyword detected, ignoring other containers")
#print("host keyword detected, ignoring other containers")
sitename = containers[0]["image"].split(":")[-1]
print(sitename)
path = produce_htcondor_host_script(containers[0], metadata)

out_jid = htcondor_batch_submit(path)
print("Job was submitted with cluster id: ", out_jid)
#print("Job was submitted with cluster id: ", out_jid)
handle_jid(out_jid, pod)

try:
Expand All @@ -559,14 +559,14 @@ def StopHandler():
request_data_string = request.data.decode("utf-8")
req = json.loads(request_data_string)
if req is None or not isinstance(req, dict):
print("Invalid delete request body is: ", req)
#print("Invalid delete request body is: ", req)
logging.error("Invalid request data")
return "Invalid request data for stopping", 400

# DELETE JOB RELATED TO REQUEST
try:
return_message = delete_pod(req)
print(return_message)
#print(return_message)
if "All" in return_message:
return "Requested pod successfully deleted", 200
else:
Expand All @@ -580,9 +580,9 @@ def StatusHandler():
logging.info("HTCondor Sidecar: received GetStatus call")
request_data_string = request.data.decode("utf-8")
req = json.loads(request_data_string)[0]
print(req)
#print(req)
if req is None or not isinstance(req, dict):
print("Invalid status request body is: ", req)
#print("Invalid status request body is: ", req)
logging.error("Invalid request data")
return "Invalid request data for getting status", 400

Expand Down Expand Up @@ -641,7 +641,7 @@ def StatusHandler():
"image": "NOT IMPLEMENTED",
"imageID": "NOT IMPLEMENTED"
})
print(json.dumps(resp))
#print(json.dumps(resp))
return json.dumps(resp), 200
except Exception as e:
return f"Something went wrong when retrieving pod status: {e}", 500
Expand All @@ -653,7 +653,7 @@ def LogsHandler():
# print(request_data_string)
req = json.loads(request_data_string)
if req is None or not isinstance(req, dict):
print("Invalid logs request body is: ", req)
#print("Invalid logs request body is: ", req)
logging.error("Invalid request data")
return "Invalid request data for getting logs", 400

Expand Down

0 comments on commit ca69b73

Please sign in to comment.