Skip to content

Commit

Permalink
Merge pull request #111 from PanDAWMS/next
Browse files Browse the repository at this point in the history
3.7.1.50
  • Loading branch information
PalNilsson authored Feb 13, 2024
2 parents 4b0b372 + f19d71a commit 569c213
Show file tree
Hide file tree
Showing 148 changed files with 8,584 additions and 6,477 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.0.36
3.7.1.50
38 changes: 28 additions & 10 deletions pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
# Authors:
# - Mario Lassnig, [email protected], 2016-17
# - Daniel Drizhuk, [email protected], 2017
# - Paul Nilsson, [email protected], 2017-23
# - Paul Nilsson, [email protected], 2017-24

"""This is the entry point for the PanDA Pilot, executed with 'python3 pilot.py <args>'."""

from __future__ import print_function # Python 2 (2to3 complains about this)
from __future__ import absolute_import

import argparse
import logging
import os
Expand All @@ -44,6 +41,7 @@
from pilot.util.auxiliary import (
pilot_version_banner,
shell_exit_code,
convert_signal_to_exit_code
)
from pilot.util.constants import (
get_pilot_version,
Expand All @@ -63,13 +61,15 @@
is_harvester_mode,
kill_worker,
)
from pilot.util.heartbeat import update_pilot_heartbeat
from pilot.util.https import (
get_panda_server,
https_setup,
send_update,
)
from pilot.util.processgroups import find_defunct_subprocesses
from pilot.util.loggingsupport import establish_logging
from pilot.util.networking import dump_ipv6_info
from pilot.util.processgroups import find_defunct_subprocesses
from pilot.util.timing import add_to_pilot_timing

errors = ErrorCodes()
Expand All @@ -84,8 +84,9 @@ def main() -> int:
# get the logger
logger = logging.getLogger(__name__)

# print the pilot version
# print the pilot version and other information
pilot_version_banner()
dump_ipv6_info()

# define threading events
args.graceful_stop = threading.Event()
Expand Down Expand Up @@ -154,6 +155,9 @@ def main() -> int:
f"pilot.workflow.{args.workflow}", globals(), locals(), [args.workflow], 0
)

# update the pilot heartbeat file
update_pilot_heartbeat(time.time())

# execute workflow
try:
exitcode = workflow.run(args)
Expand Down Expand Up @@ -700,6 +704,19 @@ def wrap_up() -> int:
if args.harvester:
kill_worker()

exitcode, shellexitcode = get_proper_exit_code()
logging.info(f"pilot has finished (exit code={exitcode}, shell exit code={shellexitcode})")
logging.shutdown()

return shellexitcode


def get_proper_exit_code() -> (int, int):
"""
Return the proper exit code.
:return: exit code (int), shell exit code (int).
"""
try:
exitcode = trace.pilot["error_code"]
except KeyError:
Expand Down Expand Up @@ -734,11 +751,11 @@ def wrap_up() -> int:
logging.warning(f"failed to convert exit code to int: {exitcode}, {exc}")
exitcode = 1008

if exitcode == 0 and args.signal:
exitcode = convert_signal_to_exit_code(args.signal)
sec = shell_exit_code(exitcode)
logging.info(f"pilot has finished (exit code={exitcode}, shell exit code={sec})")
logging.shutdown()

return sec
return exitcode, sec


def get_pilot_source_dir() -> str:
Expand Down Expand Up @@ -837,7 +854,8 @@ def list_zombies():
if __name__ == "__main__":
# get the args from the arg parser
args = get_args()
args.last_heartbeat = time.time()
args.last_heartbeat = time.time() # keep track of server heartbeats
args.pilot_heartbeat = time.time() # keep track of pilot heartbeats

# Define and set the main harvester control boolean
args.harvester = is_harvester_mode(args)
Expand Down
Loading

0 comments on commit 569c213

Please sign in to comment.