Skip to content

Commit

Permalink
Merge branch 'tickets/DM-35743'
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzm committed Jul 28, 2022
2 parents e45304d + f1f77d2 commit c7c69ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/admin/python/lsst/qserv/admin/cli/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ def worker_cmsd(ctx: click.Context, **kwargs: Any) -> None:
@cmsd_worker_cfg_path_option()
@xrdssi_cfg_file_option()
@xrdssi_cfg_path_option()
@log_cfg_file_option()
@targs_options()
@cmd_options()
@options_file_option()
Expand All @@ -608,6 +609,7 @@ def worker_xrootd(ctx: click.Context, **kwargs: Any) -> None:
cmsd_worker_cfg_path=targs["cmsd_worker_cfg_path"],
xrdssi_cfg_file=targs["xrdssi_cfg_file"],
xrdssi_cfg_path=targs["xrdssi_cfg_path"],
log_cfg_file=targs["log_cfg_file"],
cmd=targs["cmd"],
)

Expand All @@ -631,6 +633,7 @@ def worker_xrootd(ctx: click.Context, **kwargs: Any) -> None:
default="{{repl_connection}}",
show_default=True,
)
@log_cfg_file_option()
@targs_options()
@run_option()
@options_file_option()
Expand All @@ -641,6 +644,7 @@ def worker_repl(ctx: click.Context, **kwargs: Any) -> None:
db_admin_uri=targs["db_admin_uri"],
repl_connection=targs["repl_connection"],
debug_port=targs["debug_port"],
log_cfg_file=targs["log_cfg_file"],
cmd=targs["cmd"],
run=targs["run"],
)
Expand Down
13 changes: 11 additions & 2 deletions src/admin/python/lsst/qserv/admin/cli/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def enter_worker_xrootd(
cmsd_worker_cfg_path: str,
xrdssi_cfg_file: str,
xrdssi_cfg_path: str,
log_cfg_file: str,
cmd: str,
) -> None:
"""Start a worker xrootd node.
Expand Down Expand Up @@ -422,6 +423,8 @@ def enter_worker_xrootd(
The path to the xrdssi config file.
xrdssi_cfg_path : str
The location to render to the xrdssi config file.
log_cfg_file : `str`
Location of the log4cxx config file.
cmd : `str`
The jinja2 template for the command for this function to execute.
"""
Expand Down Expand Up @@ -463,13 +466,15 @@ def enter_worker_xrootd(
apply_template_cfg_file(cmsd_worker_cfg_file, cmsd_worker_cfg_path)
apply_template_cfg_file(xrdssi_cfg_file, xrdssi_cfg_path)

sys.exit(_run(args=None, cmd=cmd))
env = dict(os.environ, LSST_LOG_CONFIG=log_cfg_file)
sys.exit(_run(args=None, env=env, cmd=cmd))


def enter_worker_repl(
db_admin_uri: str,
repl_connection: str,
debug_port: Optional[int],
log_cfg_file: str,
cmd: str,
run: bool,
) -> None:
Expand All @@ -488,6 +493,8 @@ def enter_worker_repl(
"qsreplica".
debug_port : int or None
If not None, indicates that gdbserver should be run on the given port number.
log_cfg_file : `str`
Location of the log4cxx config file.
cmd : `str`
The jinja2 template for the command for this function to execute.
run : `bool`
Expand Down Expand Up @@ -524,6 +531,8 @@ def enter_worker_repl(
if not os.path.exists(ingest_folder):
os.makedirs(ingest_folder)

env = dict(os.environ, LSST_LOG_CONFIG=log_cfg_file)

while True:
# This loop exists because it is possible for qserv-replica-worker to
# register itself with the replica controller before the call to
Expand All @@ -534,7 +543,7 @@ def enter_worker_repl(
# qserv-replica-worker returned then by definition it failed, and we
# just wait a moment and restart it.
# This is recorded in DM-31252
_run(args=None, cmd=cmd, run=run)
_run(args=None, cmd=cmd, env=env, run=run)
_log.info("qserv-replica-worker exited. waiting 5 seconds and restarting.")
time.sleep(5)

Expand Down

0 comments on commit c7c69ed

Please sign in to comment.