diff --git a/src/admin/python/lsst/qserv/admin/cli/entrypoint.py b/src/admin/python/lsst/qserv/admin/cli/entrypoint.py index 16c47e0d6..92efc83b9 100644 --- a/src/admin/python/lsst/qserv/admin/cli/entrypoint.py +++ b/src/admin/python/lsst/qserv/admin/cli/entrypoint.py @@ -56,6 +56,7 @@ repl_auth_key_option, repl_connection_option, results_dirname_option, + results_protocol_option, run_option, run_tests_option, targs_options, @@ -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() @@ -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"], @@ -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() @@ -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"], @@ -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"], diff --git a/src/admin/python/lsst/qserv/admin/cli/options.py b/src/admin/python/lsst/qserv/admin/cli/options.py index 0d3040cb0..5c3c4831e 100644 --- a/src/admin/python/lsst/qserv/admin/cli/options.py +++ b/src/admin/python/lsst/qserv/admin/cli/options.py @@ -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", @@ -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, diff --git a/src/admin/python/lsst/qserv/admin/cli/script.py b/src/admin/python/lsst/qserv/admin/cli/script.py index 0eb912374..d156a5e8a 100644 --- a/src/admin/python/lsst/qserv/admin/cli/script.py +++ b/src/admin/python/lsst/qserv/admin/cli/script.py @@ -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, @@ -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 @@ -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, @@ -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 @@ -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",), @@ -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) @@ -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, @@ -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` diff --git a/src/admin/templates/xrootd/etc/xrdssi.cf.jinja b/src/admin/templates/xrootd/etc/xrdssi.cf.jinja index 59981c1c9..66dd6512a 100644 --- a/src/admin/templates/xrootd/etc/xrdssi.cf.jinja +++ b/src/admin/templates/xrootd/etc/xrdssi.cf.jinja @@ -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.