Skip to content

Commit

Permalink
Merge pull request #811 from lsst/tickets/DM-40678
Browse files Browse the repository at this point in the history
Tickets/dm 40678
  • Loading branch information
fjammes authored Oct 4, 2023
2 parents 980d965 + a60af34 commit 3f27997
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 40 deletions.
10 changes: 3 additions & 7 deletions src/admin/python/lsst/qserv/admin/cli/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
repl_auth_key_option,
repl_connection_option,
results_dirname_option,
results_protocol_option,
run_option,
run_tests_option,
targs_options,
Expand Down Expand Up @@ -553,6 +554,7 @@ def xrootd_manager(ctx: click.Context, **kwargs: Any) -> None:
@db_uri_option(help=worker_db_help)
@vnid_config_option(required=True)
@results_dirname_option()
@results_protocol_option()
@cmsd_manager_name_option()
@cmsd_manager_count_option()
@debug_option()
Expand All @@ -569,7 +571,6 @@ def worker_cmsd(ctx: click.Context, **kwargs: Any) -> None:
targs = render_targs(targs)
script.enter_worker_cmsd(
targs=targs,
debug_port=targs["debug_port"],
db_uri=targs["db_uri"],
cmsd_worker_cfg_file=targs["cmsd_worker_cfg_file"],
cmsd_worker_cfg_path=targs["cmsd_worker_cfg_path"],
Expand All @@ -587,6 +588,7 @@ def worker_cmsd(ctx: click.Context, **kwargs: Any) -> None:
@db_admin_uri_option(help=admin_worker_db_help)
@vnid_config_option(required=True)
@results_dirname_option()
@results_protocol_option()
@cmsd_manager_name_option()
@cmsd_manager_count_option()
@mysql_monitor_password_option()
Expand All @@ -604,13 +606,8 @@ def worker_xrootd(ctx: click.Context, **kwargs: Any) -> None:
targs = render_targs(targs)
script.enter_worker_xrootd(
targs=targs,
debug_port=targs["debug_port"],
db_uri=targs["db_uri"],
db_admin_uri=targs["db_admin_uri"],
vnid_config=targs["vnid_config"],
results_dirname=targs["results_dirname"],
mysql_monitor_password=targs["mysql_monitor_password"],
db_qserv_user=targs["db_qserv_user"],
cmsd_worker_cfg_file=targs["cmsd_worker_cfg_file"],
cmsd_worker_cfg_path=targs["cmsd_worker_cfg_path"],
xrdssi_cfg_file=targs["xrdssi_cfg_file"],
Expand Down Expand Up @@ -649,7 +646,6 @@ def worker_repl(ctx: click.Context, **kwargs: Any) -> None:
script.enter_worker_repl(
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
28 changes: 20 additions & 8 deletions src/admin/python/lsst/qserv/admin/cli/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,26 @@ def __call__(self, f: Callable) -> Callable:
)


results_dirname_option = partial(
click.option,
"--results-dirname",
help="Path to a folder where worker stores result sets of queries.",
default="/qserv/data/results",
show_default=True,
)


resultProtocolChoices = ["SSI", "XROOT", "HTTP"]
results_protocol_option = partial(
click.option,
"--results-protocol",
help=f"Result delivery protocol. Allowed options are [{'|'.join(resultProtocolChoices)}]",
default="SSI",
type=click.Choice(resultProtocolChoices, case_sensitive=False),
show_default=True,
)


run_option = partial(
click.option,
"--run/--no-run",
Expand All @@ -146,14 +166,6 @@ def __call__(self, f: Callable) -> Callable:
" source (static string, a file or worker database)."
)

results_dirname_option = partial(
click.option,
"--results-dirname",
help="Path to a folder where worker stores result sets of queries.",
default="/qserv/data/results",
show_default=True,
)


xrootd_manager_option = partial(
click.option,
Expand Down
27 changes: 4 additions & 23 deletions src/admin/python/lsst/qserv/admin/cli/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ def enter_xrootd_manager(

def enter_worker_cmsd(
targs: Targs,
debug_port: Optional[int],
db_uri: str,
cmsd_worker_cfg_file: str,
cmsd_worker_cfg_path: str,
Expand All @@ -362,8 +361,6 @@ def enter_worker_cmsd(
from the specified source (static string, a file or worker database).
targs : Targs
The arguments for template expansion.
debug_port : int or None
If not None, indicates that gdbserver should be run on the given port number.
db_uri : str
The non-admin URI to the worker's database.
cmsd_worker_cfg_file : str
Expand Down Expand Up @@ -408,13 +405,8 @@ def enter_worker_cmsd(

def enter_worker_xrootd(
targs: Targs,
debug_port: Optional[int],
db_uri: str,
db_admin_uri: str,
vnid_config: str,
results_dirname: str,
mysql_monitor_password: str,
db_qserv_user: str,
cmsd_worker_cfg_file: str,
cmsd_worker_cfg_path: str,
xrdssi_cfg_file: str,
Expand All @@ -428,21 +420,10 @@ def enter_worker_xrootd(
----------
targs : Targs
The arguments for template expansion.
debug_port : int or None
If not None, indicates that gdbserver should be run on the given port number.
db_uri : str
The non-admin URI to the proxy's database.
db_admin_uri : str
The admin URI to the proxy's database.
vnid_config : str
The config parameters used by the qserv cmsd to get the vnid
from the specified source (static string, a file or worker database).
results_dirname : str
A path to a folder where query results will be stored.
mysql_monitor_password : str
The password used by applications that monitor via the worker database.
db_qserv_user : str
The qserv user to use for the mysql database.
cmsd_worker_cfg_file : str
The path to the worker cmsd config file.
cmsd_worker_cfg_path : str
Expand All @@ -466,6 +447,9 @@ def enter_worker_xrootd(
# MLOCK_AMOUNT=$(grep MemTotal /proc/meminfo | awk '{printf("%.0f\n", $2 - 1000000)}')
# ulimit -l "$MLOCK_AMOUNT"

if not os.path.exists(targs["results_dirname"]):
os.makedirs(targs["results_dirname"])

url = _process_uri(
uri=db_uri,
query_keys=("socket",),
Expand All @@ -489,7 +473,7 @@ def enter_worker_xrootd(
smig_worker(db_admin_uri, update=False)

# TODO worker (and manager) xrootd+cmsd pair should "share" the cfg file
# it's in different pods but should be same source & processing.
# it's in different containers but should be same source & processing.
# Rename these files to be more agnostic.
apply_template_cfg_file(cmsd_worker_cfg_file, cmsd_worker_cfg_path)
apply_template_cfg_file(xrdssi_cfg_file, xrdssi_cfg_path)
Expand All @@ -506,7 +490,6 @@ def enter_worker_xrootd(
def enter_worker_repl(
db_admin_uri: str,
repl_connection: str,
debug_port: Optional[int],
log_cfg_file: str,
cmd: str,
run: bool,
Expand All @@ -524,8 +507,6 @@ def enter_worker_repl(
The connection string for the replication manager database for the
non-admin user (created using the `connection`), the user is typically
"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`
Expand Down
4 changes: 2 additions & 2 deletions src/admin/templates/xrootd/etc/xrdssi.cf.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ xrootd_port = 1094
num_http_threads = 4

# Result delivery protocol. Allowed options:
# SSI - XROOTD/SSI stream (the default mode if no specific choice is proided)
# SSI - XROOTD/SSI stream (the default mode if no specific choice is provided)
# XROOT - XROOT file protocol
# HTTP - HTTP protocol
protocol = SSI
protocol = {{ results_protocol }}

# Set to any value but 0 if result files (if any) left after the previous run of
# the worker had to be deleted from the corresponding folder.
Expand Down

0 comments on commit 3f27997

Please sign in to comment.