lsst-ctrl-bps 30.0.11__tar.gz → 30.0.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lsst_ctrl_bps-30.0.11/python/lsst_ctrl_bps.egg-info → lsst_ctrl_bps-30.0.12}/PKG-INFO +1 -1
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/doc/lsst.ctrl.bps/CHANGES.rst +17 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/doc/lsst.ctrl.bps/quickstart.rst +137 -0
- lsst_ctrl_bps-30.0.12/python/lsst/ctrl/bps/batch_submit.py +357 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/bps_config.py +135 -30
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/bps_reports.py +24 -5
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/cmd/__init__.py +4 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/cmd/commands.py +25 -3
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/constants.py +5 -5
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/drivers.py +168 -51
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/etc/bps_defaults.yaml +27 -5
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/generic_workflow.py +17 -1
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/initialize.py +129 -52
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/pre_transform.py +26 -9
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/report.py +2 -14
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/tests/gw_test_utils.py +42 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/transform.py +148 -43
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/version.py +1 -1
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/wms_service.py +15 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12/python/lsst_ctrl_bps.egg-info}/PKG-INFO +1 -1
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/SOURCES.txt +2 -0
- lsst_ctrl_bps-30.0.12/tests/test_batch_submit.py +352 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_bps_reports.py +53 -12
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_bpsconfig.py +271 -1
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_cli_commands.py +30 -2
- lsst_ctrl_bps-30.0.12/tests/test_drivers.py +615 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_pre_transform.py +105 -13
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_transform.py +226 -81
- lsst_ctrl_bps-30.0.11/tests/test_drivers.py +0 -329
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/COPYRIGHT +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/LICENSE +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/MANIFEST.in +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/README.md +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/bsd_license.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/doc/lsst.ctrl.bps/index.rst +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/gpl-v3.0.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/pyproject.toml +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/__init__.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/__init__.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/__init__.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/_exceptions.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/bps_draw.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/bps_utils.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cancel.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/__init__.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/bps.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/opt/__init__.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/opt/arguments.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/opt/option_groups.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/cli/opt/options.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/clustered_quantum_graph.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/construct.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/ping.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/prepare.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/quantum_clustering_funcs.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/restart.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/status.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/submit.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst/ctrl/bps/tests/config_test_utils.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/dependency_links.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/entry_points.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/requires.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/top_level.txt +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/python/lsst_ctrl_bps.egg-info/zip-safe +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/setup.cfg +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_bps_utils.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_clustered_quantum_graph.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_construct.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_generic_workflow.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_initialize.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_ping.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_quantum_clustering_funcs.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_report.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_status.py +0 -0
- {lsst_ctrl_bps-30.0.11 → lsst_ctrl_bps-30.0.12}/tests/test_wms_service.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lsst-ctrl-bps
|
|
3
|
-
Version: 30.0.
|
|
3
|
+
Version: 30.0.12
|
|
4
4
|
Summary: Pluggable execution of workflow graphs from Rubin pipelines.
|
|
5
5
|
Author-email: Rubin Observatory Data Management <dm-admin@lists.lsst.org>
|
|
6
6
|
License-Expression: BSD-3-Clause OR GPL-3.0-or-later
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
lsst-ctrl-bps v30.0.12 (2026-10-27)
|
|
2
|
+
===================================
|
|
3
|
+
|
|
4
|
+
New Features
|
|
5
|
+
------------
|
|
6
|
+
|
|
7
|
+
- Added ability to run submit processes as batch jobs on same cluster with shared filesystems. (`DM-53494 <https://rubinobs.atlassian.net/browse/DM-53494>`_)
|
|
8
|
+
- Made improvements to how the environment specifications in submit yaml are handled. See ``Job Environment`` section in docs for details and examples.
|
|
9
|
+
Environment variables set in several ``includeConfigs`` files can now chain onto each other with ``${VAR}``, whatever the variable is called. (`DM-53944 <https://rubinobs.atlassian.net/browse/DM-53944>`_)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Bug Fixes
|
|
13
|
+
---------
|
|
14
|
+
|
|
15
|
+
- Updated default value for ``--hist`` to 0.5 so that ``bps status`` will show status for recently completed runs. Also updated the default for ``bps report`` so the default behavior is the same. (`DM-56633 <https://rubinobs.atlassian.net/browse/DM-56633>`_)
|
|
16
|
+
|
|
17
|
+
|
|
1
18
|
lsst-ctrl-bps v30.0.8 (2026-06-08)
|
|
2
19
|
==================================
|
|
3
20
|
|
|
@@ -1541,6 +1541,94 @@ invisible to the user. ``bps report`` will still show same labels and
|
|
|
1541
1541
|
total counts as without ordering. ``cancel`` and ``restart`` will still
|
|
1542
1542
|
work the same.
|
|
1543
1543
|
|
|
1544
|
+
|
|
1545
|
+
.. _job-environment:
|
|
1546
|
+
|
|
1547
|
+
Job Environment
|
|
1548
|
+
---------------
|
|
1549
|
+
|
|
1550
|
+
One can specify environment values for jobs in the submit yaml. When creating
|
|
1551
|
+
the job description for the WMS-plugins, BPS will search for environment
|
|
1552
|
+
settings following normal scoping ordering, but performs a special merge
|
|
1553
|
+
instead of replacing the entire section. Also if an environment value itself
|
|
1554
|
+
contains another yaml environment variable, BPS will replace that yaml environment
|
|
1555
|
+
variable with its yaml value. This will allow normal shell path chaining behavior
|
|
1556
|
+
across sections.
|
|
1557
|
+
|
|
1558
|
+
.. note::
|
|
1559
|
+
|
|
1560
|
+
To not include an environment variable from another section, use the special
|
|
1561
|
+
string ``BPS_NONE`` as the environment variable value (case-insensitive).
|
|
1562
|
+
|
|
1563
|
+
.. note::
|
|
1564
|
+
|
|
1565
|
+
The same chaining applies when several files pulled in via ``includeConfigs`` set the same environment variable in the same section.
|
|
1566
|
+
Each later file chains onto the earlier ones and the including file chains onto all of them.
|
|
1567
|
+
For example, two included files that each prepend a directory to ``DAF_BUTLER_CONFIG_PATH`` produce a single value listing both directories.
|
|
1568
|
+
|
|
1569
|
+
Here are some examples of the environment variables that BPS instructs
|
|
1570
|
+
the WMS-plugin to set inside the job, based on the following BPS YAML
|
|
1571
|
+
configuration. Any environmental variable left in the final value (here
|
|
1572
|
+
``${PACKAGE_DIR}`` and ``${VAR_PATH}``) will be expanded from the job's
|
|
1573
|
+
shell environment as usual.
|
|
1574
|
+
|
|
1575
|
+
.. code-block:: YAML
|
|
1576
|
+
|
|
1577
|
+
var1: "root_val1"
|
|
1578
|
+
environment:
|
|
1579
|
+
VAR2: "root_val2"
|
|
1580
|
+
VAR3: "root_val3"
|
|
1581
|
+
VAR_PATH: "${PACKAGE_DIR}/root_dir:${VAR_PATH}"
|
|
1582
|
+
TEST_VAR: "one {var1} three"
|
|
1583
|
+
site:
|
|
1584
|
+
site1:
|
|
1585
|
+
var1: "site_val1"
|
|
1586
|
+
environment:
|
|
1587
|
+
VAR4: "site_val4"
|
|
1588
|
+
VAR_PATH: "${PACKAGE_DIR}/site_dir:${VAR_PATH}"
|
|
1589
|
+
cluster:
|
|
1590
|
+
cl1:
|
|
1591
|
+
var1: "cl1_val1"
|
|
1592
|
+
environment:
|
|
1593
|
+
VAR2: "BPS_NONE"
|
|
1594
|
+
VAR3: "cl1_val3"
|
|
1595
|
+
VAR4: "cl1_val4"
|
|
1596
|
+
|
|
1597
|
+
#. BPS environment for a cl1 job for site1:
|
|
1598
|
+
|
|
1599
|
+
.. code-block::
|
|
1600
|
+
|
|
1601
|
+
VAR3="cl1_val3"
|
|
1602
|
+
VAR4="cl1_val4"
|
|
1603
|
+
VAR_PATH="${PACKAGE_DIR}/site_dir:${PACKAGE_DIR}/root_dir:${VAR_PATH}"
|
|
1604
|
+
TEST_VAR="one cl1_val1 three"
|
|
1605
|
+
|
|
1606
|
+
#. BPS environment for a non-cl1 job for site1:
|
|
1607
|
+
|
|
1608
|
+
.. code-block::
|
|
1609
|
+
|
|
1610
|
+
VAR2="root_val2"
|
|
1611
|
+
VAR3="root_val3"
|
|
1612
|
+
VAR4="site_val4"
|
|
1613
|
+
VAR_PATH="${PACKAGE_DIR}/site_dir:${PACKAGE_DIR}/root_dir:${VAR_PATH}"
|
|
1614
|
+
TEST_VAR="one site_val1 three"
|
|
1615
|
+
|
|
1616
|
+
#. BPS environment for a non-cli job for some site other than site1:
|
|
1617
|
+
|
|
1618
|
+
.. code-block::
|
|
1619
|
+
|
|
1620
|
+
VAR2="root_val2"
|
|
1621
|
+
VAR3="root_val3"
|
|
1622
|
+
VAR_PATH="${PACKAGE_DIR}/root_dir:${VAR_PATH}"
|
|
1623
|
+
TEST_VAR="one root_val1 three"
|
|
1624
|
+
|
|
1625
|
+
Different WMS-plugins create the job environment via different mechanisms
|
|
1626
|
+
(e.g., the HTCondor plugin copies the submit environment to the job) or may
|
|
1627
|
+
not support setting the environment via submit yaml. If the WMS-plugin
|
|
1628
|
+
supports setting the environment via submit yaml, the job environment is
|
|
1629
|
+
require to at least include what is in the submit yaml, but it may include
|
|
1630
|
+
more environment settings.
|
|
1631
|
+
|
|
1544
1632
|
.. _bps-config-generation:
|
|
1545
1633
|
|
|
1546
1634
|
Config Generation
|
|
@@ -1613,6 +1701,55 @@ Parsl).
|
|
|
1613
1701
|
responsibility to remove them once no longer needed. The removal
|
|
1614
1702
|
should be done regularly to avoid too many in single directory.
|
|
1615
1703
|
|
|
1704
|
+
.. _bps_submit_as_batch:
|
|
1705
|
+
|
|
1706
|
+
Submit Stages as Batch Jobs
|
|
1707
|
+
---------------------------
|
|
1708
|
+
|
|
1709
|
+
In cases where one cannot run ``bps submit`` interactively (e.g., needs
|
|
1710
|
+
too much memory), BPS can run the submit processes as batch jobs after
|
|
1711
|
+
which the payload workflow will start running. This also is necessary
|
|
1712
|
+
when running at a remote site (i.e., a site where the butler repository
|
|
1713
|
+
isn't directly accessible).
|
|
1714
|
+
|
|
1715
|
+
.. note::
|
|
1716
|
+
|
|
1717
|
+
Currently only the HTCondor WMS plugin supports this feature as described
|
|
1718
|
+
below. The PanDA WMS plugin uses a special PanDA feature to run
|
|
1719
|
+
``bps submit`` on a remote site. See PanDA documentation for details.
|
|
1720
|
+
|
|
1721
|
+
To tell BPS to execute submit stages as batch jobs, the submit yaml must
|
|
1722
|
+
set ``bpsBatchSubmission`` to ``true``.
|
|
1723
|
+
|
|
1724
|
+
The interactive submission process, ``bps submit <submit yaml>``,
|
|
1725
|
+
is much shorter. It will create a workflow with two jobs:
|
|
1726
|
+
|
|
1727
|
+
- ``buildQuantumGraph`` which creates the quantum graph.
|
|
1728
|
+
- ``preparePayloadWorkflow`` which does the rest of the submission stages
|
|
1729
|
+
seen when running ``bps submit``. These include clustering, creation of
|
|
1730
|
+
the payload workflow, and preparing the WMS-specific workflow.
|
|
1731
|
+
|
|
1732
|
+
One can set runtime values specific to those jobs (e.g., ``requestMemory``) in
|
|
1733
|
+
sections with corresponding names similar to ``finalJob``. Currently the
|
|
1734
|
+
logging-related command-line arguments aren't passed from ``bps submit``
|
|
1735
|
+
to these jobs. Instead, one can set ``bpsPreCommandOpts``, which has the
|
|
1736
|
+
same default as the payload job.
|
|
1737
|
+
|
|
1738
|
+
Even with the new jobs, there is only one output run collection, one submit
|
|
1739
|
+
directory and one top level WMS ID to be used with BPS commands.
|
|
1740
|
+
|
|
1741
|
+
``bps report --id <id|path>`` will show these 2 new jobs same as the payload
|
|
1742
|
+
jobs. They will be the only lines to appear in the report until the
|
|
1743
|
+
``preparePayloadWorkflow`` has finished at which time the expected payload
|
|
1744
|
+
lines should appear (from ``pipetaskInit`` through ``finalJob``).
|
|
1745
|
+
|
|
1746
|
+
``bps cancel`` can be used to abort the run during these new jobs or later
|
|
1747
|
+
during the running of the payload jobs. Note, the ``finalJob`` job won't
|
|
1748
|
+
automatically run unless the payload workflow was successfully submitted.
|
|
1749
|
+
|
|
1750
|
+
See the corresponding section in the WMS-plugin documentation for additional
|
|
1751
|
+
information and yaml settings.
|
|
1752
|
+
|
|
1616
1753
|
.. _bps-troubleshooting:
|
|
1617
1754
|
|
|
1618
1755
|
Troubleshooting
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# This file is part of ctrl_bps.
|
|
2
|
+
#
|
|
3
|
+
# Developed for the LSST Data Management System.
|
|
4
|
+
# This product includes software developed by the LSST Project
|
|
5
|
+
# (https://www.lsst.org).
|
|
6
|
+
# See the COPYRIGHT file at the top-level directory of this distribution
|
|
7
|
+
# for details of code ownership.
|
|
8
|
+
#
|
|
9
|
+
# This software is dual licensed under the GNU General Public License and also
|
|
10
|
+
# under a 3-clause BSD license. Recipients may choose which of these licenses
|
|
11
|
+
# to use; please see the files gpl-3.0.txt and/or bsd_license.txt,
|
|
12
|
+
# respectively. If you choose the GPL option then the following text applies
|
|
13
|
+
# (but note that there is still no warranty even if you opt for BSD instead):
|
|
14
|
+
#
|
|
15
|
+
# This program is free software: you can redistribute it and/or modify
|
|
16
|
+
# it under the terms of the GNU General Public License as published by
|
|
17
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
18
|
+
# (at your option) any later version.
|
|
19
|
+
#
|
|
20
|
+
# This program is distributed in the hope that it will be useful,
|
|
21
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
# GNU General Public License for more details.
|
|
24
|
+
#
|
|
25
|
+
# You should have received a copy of the GNU General Public License
|
|
26
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
27
|
+
|
|
28
|
+
"""Driver to run submit stages as batch jobs."""
|
|
29
|
+
|
|
30
|
+
__all__ = ["batch_payload_prepare", "batch_submit", "create_batch_stages"]
|
|
31
|
+
|
|
32
|
+
import logging
|
|
33
|
+
import os
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
|
|
36
|
+
from lsst.resources import ResourcePath, ResourcePathExpression
|
|
37
|
+
from lsst.utils.logging import VERBOSE
|
|
38
|
+
from lsst.utils.timer import time_this, timeMethod
|
|
39
|
+
|
|
40
|
+
from . import (
|
|
41
|
+
DEFAULT_MEM_FMT,
|
|
42
|
+
DEFAULT_MEM_UNIT,
|
|
43
|
+
BpsConfig,
|
|
44
|
+
GenericWorkflow,
|
|
45
|
+
GenericWorkflowFile,
|
|
46
|
+
GenericWorkflowJob,
|
|
47
|
+
GenericWorkflowLazyGroup,
|
|
48
|
+
)
|
|
49
|
+
from .bps_utils import _make_id_link
|
|
50
|
+
from .pre_transform import cluster_quanta, read_quantum_graph
|
|
51
|
+
from .prepare import prepare
|
|
52
|
+
from .submit import submit
|
|
53
|
+
from .transform import _enhance_command, _get_job_values, transform
|
|
54
|
+
|
|
55
|
+
_LOG = logging.getLogger(__name__)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@timeMethod(logger=_LOG, logLevel=VERBOSE)
|
|
59
|
+
def create_batch_stages(
|
|
60
|
+
config: BpsConfig, prefix: ResourcePathExpression
|
|
61
|
+
) -> tuple[GenericWorkflow, BpsConfig]:
|
|
62
|
+
"""Create a GenericWorkflow that performs the submit stages as a workflow.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
config : `lsst.ctrl.bps.BpsConfig`
|
|
67
|
+
BPS configuration.
|
|
68
|
+
prefix : `lsst.resources.ResourcePathExpression`
|
|
69
|
+
Root path for any output files.
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
-------
|
|
73
|
+
generic_workflow : `lsst.ctrl.bps.GenericWorkflow`
|
|
74
|
+
The generic workflow transformed from the clustered quantum graph.
|
|
75
|
+
generic_workflow_config : `lsst.ctrl.bps.BpsConfig`
|
|
76
|
+
Configuration to accompany GenericWorkflow.
|
|
77
|
+
"""
|
|
78
|
+
prefix = ResourcePath(prefix)
|
|
79
|
+
generic_workflow: GenericWorkflow = GenericWorkflow(name=f"{config['uniqProcName']}_ctrl")
|
|
80
|
+
generic_workflow.run_attrs.update(
|
|
81
|
+
{
|
|
82
|
+
"bps_isjob": "True",
|
|
83
|
+
"bps_project": config["project"],
|
|
84
|
+
"bps_campaign": config["campaign"],
|
|
85
|
+
"bps_run": config["uniqProcName"],
|
|
86
|
+
"bps_runsite": config["computeSite"],
|
|
87
|
+
"bps_operator": config["operator"],
|
|
88
|
+
"bps_payload": config["payloadName"],
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Save full run QuantumGraph for use by jobs
|
|
93
|
+
qgraph_file = GenericWorkflowFile(
|
|
94
|
+
"runQgraphFile",
|
|
95
|
+
src_uri=config["runQgraphFile"],
|
|
96
|
+
wms_transfer=True,
|
|
97
|
+
job_access_remote=True,
|
|
98
|
+
job_shared=True,
|
|
99
|
+
)
|
|
100
|
+
generic_workflow.add_file(qgraph_file)
|
|
101
|
+
|
|
102
|
+
# Save config file for use by jobs
|
|
103
|
+
config_file = GenericWorkflowFile(
|
|
104
|
+
"configFile",
|
|
105
|
+
src_uri=config["configFile"],
|
|
106
|
+
wms_transfer=True,
|
|
107
|
+
job_access_remote=False,
|
|
108
|
+
job_shared=True,
|
|
109
|
+
)
|
|
110
|
+
generic_workflow.add_file(config_file)
|
|
111
|
+
|
|
112
|
+
# Build QuantumGraph job
|
|
113
|
+
build_job = GenericWorkflowJob(
|
|
114
|
+
name="buildQuantumGraph",
|
|
115
|
+
label="buildQuantumGraph",
|
|
116
|
+
)
|
|
117
|
+
search_opt = config.get_search_opts(build_job.label)
|
|
118
|
+
search_opt.update(
|
|
119
|
+
{
|
|
120
|
+
"replaceVars": False,
|
|
121
|
+
"expandEnvVars": False,
|
|
122
|
+
"replaceEnvVars": True,
|
|
123
|
+
"required": False,
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
cmd_line_key = "jobCommand"
|
|
127
|
+
job_values = _get_job_values(config, search_opt, cmd_line_key)
|
|
128
|
+
if not job_values["executable"]:
|
|
129
|
+
raise RuntimeError(
|
|
130
|
+
f"Missing executable for buildQuantumGraph. Double check submit yaml for {cmd_line_key}"
|
|
131
|
+
)
|
|
132
|
+
for key, value in job_values.items():
|
|
133
|
+
if key not in {"name", "label"}:
|
|
134
|
+
setattr(build_job, key, value)
|
|
135
|
+
|
|
136
|
+
generic_workflow.add_job(build_job)
|
|
137
|
+
_LOG.debug("build job's arguments: %s", build_job.arguments)
|
|
138
|
+
|
|
139
|
+
generic_workflow.add_file(config_file)
|
|
140
|
+
generic_workflow.add_job_outputs(build_job.name, [qgraph_file])
|
|
141
|
+
generic_workflow.add_job_inputs(build_job.name, [config_file])
|
|
142
|
+
_enhance_command(config, generic_workflow, build_job, job_values)
|
|
143
|
+
_LOG.debug("build job's arguments: %s", build_job.arguments)
|
|
144
|
+
|
|
145
|
+
# Build cluster/transform/prepare job
|
|
146
|
+
prepare_job = GenericWorkflowLazyGroup(
|
|
147
|
+
name="preparePayloadWorkflow",
|
|
148
|
+
label="preparePayloadWorkflow",
|
|
149
|
+
)
|
|
150
|
+
search_opt = config.get_search_opts(prepare_job.label)
|
|
151
|
+
search_opt.update(
|
|
152
|
+
{
|
|
153
|
+
"replaceVars": False,
|
|
154
|
+
"expandEnvVars": False,
|
|
155
|
+
"replaceEnvVars": True,
|
|
156
|
+
"required": False,
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
_LOG.debug("preparePayloadWorkflow search_opt = %s", search_opt)
|
|
160
|
+
cmd_line_key = "jobCommand"
|
|
161
|
+
job_values = _get_job_values(config, search_opt, cmd_line_key)
|
|
162
|
+
if not job_values["executable"]:
|
|
163
|
+
raise RuntimeError(
|
|
164
|
+
f"Missing executable for preparePayloadWorkflow. Double check submit yaml for {cmd_line_key}"
|
|
165
|
+
)
|
|
166
|
+
for key, value in job_values.items():
|
|
167
|
+
if key not in {"name", "label"}:
|
|
168
|
+
setattr(prepare_job, key, value)
|
|
169
|
+
|
|
170
|
+
generic_workflow.add_job(prepare_job, parent_names=["buildQuantumGraph"])
|
|
171
|
+
generic_workflow.add_job_inputs(prepare_job.name, [qgraph_file, config_file])
|
|
172
|
+
_enhance_command(config, generic_workflow, prepare_job, job_values)
|
|
173
|
+
|
|
174
|
+
_, save_workflow = config.search("saveGenericWorkflow", opt={"default": False})
|
|
175
|
+
if save_workflow:
|
|
176
|
+
with prefix.join("bps_stages_generic_workflow.pickle").open("wb") as outfh:
|
|
177
|
+
generic_workflow.save(outfh, "pickle")
|
|
178
|
+
|
|
179
|
+
return generic_workflow, config
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@timeMethod(logger=_LOG, logLevel=VERBOSE)
|
|
183
|
+
def batch_payload_prepare(config: BpsConfig, prefix: ResourcePathExpression) -> None:
|
|
184
|
+
"""Create a GenericWorkflow that performs the submit stages as a workflow.
|
|
185
|
+
|
|
186
|
+
Parameters
|
|
187
|
+
----------
|
|
188
|
+
config : `lsst.ctrl.bps.BpsConfig`
|
|
189
|
+
BPS configuration.
|
|
190
|
+
prefix : `lsst.resources.ResourcePathExpression`
|
|
191
|
+
Root path for any output files.
|
|
192
|
+
|
|
193
|
+
Returns
|
|
194
|
+
-------
|
|
195
|
+
generic_workflow : `lsst.ctrl.bps.GenericWorkflow`
|
|
196
|
+
The generic workflow transformed from the clustered quantum graph.
|
|
197
|
+
generic_workflow_config : `lsst.ctrl.bps.BpsConfig`
|
|
198
|
+
Configuration to accompany GenericWorkflow.
|
|
199
|
+
"""
|
|
200
|
+
# Read existing QuantumGraph
|
|
201
|
+
qgraph_uri = config["runQgraphFile"]
|
|
202
|
+
qgraph = read_quantum_graph(qgraph_uri)
|
|
203
|
+
|
|
204
|
+
# Cluster
|
|
205
|
+
_LOG.info("Starting cluster stage (grouping quanta into jobs)")
|
|
206
|
+
with time_this(
|
|
207
|
+
log=_LOG,
|
|
208
|
+
level=logging.INFO,
|
|
209
|
+
prefix=None,
|
|
210
|
+
msg="Cluster stage completed",
|
|
211
|
+
mem_usage=True,
|
|
212
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
213
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
214
|
+
):
|
|
215
|
+
clustered_qgraph = cluster_quanta(config, qgraph, config["uniqProcName"])
|
|
216
|
+
|
|
217
|
+
_LOG.info("ClusteredQuantumGraph contains %d cluster(s)", len(clustered_qgraph))
|
|
218
|
+
|
|
219
|
+
submit_path = config[".bps_defined.submitPath"]
|
|
220
|
+
_, save_clustered_qgraph = config.search("saveClusteredQgraph", opt={"default": False})
|
|
221
|
+
if save_clustered_qgraph:
|
|
222
|
+
clustered_qgraph.save(os.path.join(submit_path, "bps_clustered_qgraph.pickle"))
|
|
223
|
+
_, save_dot = config.search("saveDot", opt={"default": False})
|
|
224
|
+
if save_dot:
|
|
225
|
+
clustered_qgraph.draw(os.path.join(submit_path, "bps_clustered_qgraph.dot"))
|
|
226
|
+
|
|
227
|
+
# Transform
|
|
228
|
+
_LOG.info("Starting transform stage (creating generic workflow)")
|
|
229
|
+
with time_this(
|
|
230
|
+
log=_LOG,
|
|
231
|
+
level=logging.INFO,
|
|
232
|
+
prefix=None,
|
|
233
|
+
msg="Transform stage completed",
|
|
234
|
+
mem_usage=True,
|
|
235
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
236
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
237
|
+
):
|
|
238
|
+
generic_workflow, generic_workflow_config = transform(config, clustered_qgraph, submit_path)
|
|
239
|
+
_LOG.info("Generic workflow name '%s'", generic_workflow.name)
|
|
240
|
+
|
|
241
|
+
num_jobs = sum(generic_workflow.job_counts.values())
|
|
242
|
+
_LOG.info("GenericWorkflow contains %d job(s) (including final)", num_jobs)
|
|
243
|
+
|
|
244
|
+
# Want to read quantum graph from temp space if told to use it.
|
|
245
|
+
gwfile = generic_workflow.get_file("runQgraphFile")
|
|
246
|
+
gwfile.wms_transfer = False
|
|
247
|
+
# Root computeSite is currently how to specify where the pipeline
|
|
248
|
+
# will actually be run.
|
|
249
|
+
found, use_run_temp_space = config.search(
|
|
250
|
+
"bpsUseRunTempSpace", opt={"curvals": {"curr_site": config[".computeSite"]}}
|
|
251
|
+
)
|
|
252
|
+
if found and use_run_temp_space:
|
|
253
|
+
found, run_temp_space = config.search(
|
|
254
|
+
"fileDistributionEndpoint", opt={"curvals": {"curr_site": config[".computeSite"]}}
|
|
255
|
+
)
|
|
256
|
+
if found:
|
|
257
|
+
_LOG.debug("run_temp_space = %s", run_temp_space)
|
|
258
|
+
gwfile.src_uri = str(Path(run_temp_space) / config["qgraphFileTemplate"])
|
|
259
|
+
else:
|
|
260
|
+
raise KeyError("Config is missing fileDistributionEndpoint.")
|
|
261
|
+
elif not found:
|
|
262
|
+
_LOG.debug("Config is missing bpsUseRunTempSpace")
|
|
263
|
+
|
|
264
|
+
_, save_workflow = config.search("saveGenericWorkflow", opt={"default": False})
|
|
265
|
+
if save_workflow:
|
|
266
|
+
with open(os.path.join(submit_path, "bps_generic_workflow.pickle"), "wb") as outfh:
|
|
267
|
+
generic_workflow.save(outfh, "pickle")
|
|
268
|
+
_, save_dot = config.search("saveDot", opt={"default": False})
|
|
269
|
+
if save_dot:
|
|
270
|
+
with open(os.path.join(submit_path, "bps_generic_workflow.dot"), "w") as outfh:
|
|
271
|
+
generic_workflow.draw(outfh, "dot")
|
|
272
|
+
|
|
273
|
+
# Prepare
|
|
274
|
+
_LOG.info("Starting prepare stage (creating specific implementation of workflow)")
|
|
275
|
+
with time_this(
|
|
276
|
+
log=_LOG,
|
|
277
|
+
level=logging.INFO,
|
|
278
|
+
prefix=None,
|
|
279
|
+
msg="Prepare stage completed",
|
|
280
|
+
mem_usage=True,
|
|
281
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
282
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
283
|
+
):
|
|
284
|
+
wms_workflow = prepare(generic_workflow_config, generic_workflow, submit_path)
|
|
285
|
+
|
|
286
|
+
# Add payload workflow to currently running workflow
|
|
287
|
+
_LOG.info("Starting update workflow")
|
|
288
|
+
with time_this(
|
|
289
|
+
log=_LOG,
|
|
290
|
+
level=logging.INFO,
|
|
291
|
+
prefix=None,
|
|
292
|
+
msg="Workflow update completed",
|
|
293
|
+
mem_usage=True,
|
|
294
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
295
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
296
|
+
):
|
|
297
|
+
# Assuming submit_path for ctrl workflow is visible by this job.
|
|
298
|
+
wms_workflow.add_to_parent_workflow(generic_workflow_config)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def batch_submit(config: BpsConfig):
|
|
302
|
+
"""Submit a workflow for execution with preparation done in batch jobs.
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
config : `lsst.ctrl.bps.BpsConfig`
|
|
307
|
+
BPS configuration.
|
|
308
|
+
|
|
309
|
+
Returns
|
|
310
|
+
-------
|
|
311
|
+
wms_workflow : `lsst.ctrl.bps.BaseWmsWorkflow`
|
|
312
|
+
Submitted workflow.
|
|
313
|
+
"""
|
|
314
|
+
submit_path = config[".bps_defined.submitPath"]
|
|
315
|
+
|
|
316
|
+
_LOG.info("Starting to create control workflow")
|
|
317
|
+
with time_this(
|
|
318
|
+
log=_LOG,
|
|
319
|
+
level=logging.INFO,
|
|
320
|
+
prefix=None,
|
|
321
|
+
msg="Creation completed",
|
|
322
|
+
mem_usage=True,
|
|
323
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
324
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
325
|
+
):
|
|
326
|
+
generic_workflow, config = create_batch_stages(config, submit_path)
|
|
327
|
+
|
|
328
|
+
_LOG.info("Starting to prepare control workflow")
|
|
329
|
+
with time_this(
|
|
330
|
+
log=_LOG,
|
|
331
|
+
level=logging.INFO,
|
|
332
|
+
prefix=None,
|
|
333
|
+
msg="Preparation completed",
|
|
334
|
+
mem_usage=True,
|
|
335
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
336
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
337
|
+
):
|
|
338
|
+
wms_workflow = prepare(config, generic_workflow, submit_path)
|
|
339
|
+
|
|
340
|
+
_, dry_run = config.search("dryRun", opt={"default": False})
|
|
341
|
+
if not dry_run:
|
|
342
|
+
_LOG.info("Starting to submit control workflow")
|
|
343
|
+
with time_this(
|
|
344
|
+
log=_LOG,
|
|
345
|
+
level=logging.INFO,
|
|
346
|
+
prefix=None,
|
|
347
|
+
msg="Submission completed",
|
|
348
|
+
mem_usage=True,
|
|
349
|
+
mem_unit=DEFAULT_MEM_UNIT,
|
|
350
|
+
mem_fmt=DEFAULT_MEM_FMT,
|
|
351
|
+
):
|
|
352
|
+
submit(config, wms_workflow)
|
|
353
|
+
_LOG.info("Run '%s' submitted for execution with id '%s'", wms_workflow.name, wms_workflow.run_id)
|
|
354
|
+
|
|
355
|
+
_make_id_link(config, wms_workflow.run_id)
|
|
356
|
+
|
|
357
|
+
return wms_workflow
|