Skip to content

Commit

Permalink
Added pilot args object to get_payload_command(). Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Nilsson committed Nov 26, 2024
1 parent b839385 commit 8ebb97b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pilot/control/payloads/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,6 @@ def post_payload(self, job: JobData):
"""
# write time stamps to pilot timing file
update_time = time.time()
logger.debug(f"setting post-payload time to {update_time} s")
logger.debug(f"gmtime is {time.gmtime(update_time)}")
add_to_pilot_timing(job.jobid, PILOT_POST_PAYLOAD, update_time, self.__args)

def run_command(self, cmd: str, label: str = "") -> Any:
Expand Down Expand Up @@ -694,11 +692,10 @@ def wait_graceful(self, args: object, proc: Any) -> int:

return exit_code

def get_payload_command(self, job: JobData) -> str:
def get_payload_command(self) -> str:
"""
Return the payload command string.
:param job: job object (JobData)
:return: command (str).
"""
cmd = ""
Expand All @@ -708,14 +705,14 @@ def get_payload_command(self, job: JobData) -> str:
user = __import__(
f"pilot.user.{pilot_user}.common", globals(), locals(), [pilot_user], 0
)
cmd = user.get_payload_command(job) # + 'sleep 900' # to test looping jobs
cmd = user.get_payload_command(self.__job, args=self.__args) # + 'sleep 900' # to test looping jobs
except PilotException as error:
self.post_setup(job)
self.post_setup(self.__job)
logger.error(traceback.format_exc())
job.piloterrorcodes, job.piloterrordiags = errors.add_error_code(
self.__job.piloterrorcodes, self.__job.piloterrordiags = errors.add_error_code(
error.get_error_code()
)
self.__traces.pilot["error_code"] = job.piloterrorcodes[0]
self.__traces.pilot["error_code"] = self.__job.piloterrorcodes[0]
logger.fatal(
f"could not define payload command (traces error set to: {self.__traces.pilot['error_code']})"
)
Expand Down Expand Up @@ -802,7 +799,7 @@ def run(self) -> tuple[int, str]: # noqa: C901
self.pre_setup(self.__job)

# get the user defined payload command
cmd = self.get_payload_command(self.__job)
cmd = self.get_payload_command()
if not cmd:
logger.warning("aborting run() since payload command could not be defined")
return errors.UNKNOWNPAYLOADFAILURE, "undefined payload command"
Expand Down

0 comments on commit 8ebb97b

Please sign in to comment.