diff --git a/Cargo.lock b/Cargo.lock index 1f96194..7c6613b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" dependencies = [ "anstyle", "anstyle-parse", @@ -28,36 +28,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -184,9 +184,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "console" @@ -312,9 +312,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -327,9 +327,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -337,15 +337,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -354,27 +354,27 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -533,9 +533,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "linux-raw-sys" @@ -600,12 +600,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "parking_lot" @@ -650,9 +647,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -710,9 +707,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -737,9 +734,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -784,9 +781,11 @@ dependencies = [ "path-absolutize", "postcard", "predicates", + "regex", "serde", "serde_json", "serial_test", + "shell-quote", "signal-hook", "speedate", "thiserror", @@ -797,9 +796,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" dependencies = [ "bitflags", "errno", @@ -810,9 +809,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -831,9 +830,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.0" +version = "2.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836f1e0f4963ef5288b539b643b35e043e76a32d0f4e47e67febf69576527f50" +checksum = "d8d25269dd3a12467afe2e510f69fb0b46b698e5afb296b59f2145259deaf8e8" dependencies = [ "sdd", ] @@ -846,9 +845,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sdd" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a7b59a5d9b0099720b417b6325d91a52cbf5b3dcb5041d864be53eefa58abc" +checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "serde" @@ -916,6 +915,12 @@ dependencies = [ "syn", ] +[[package]] +name = "shell-quote" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae4c63bdcc11eea49b562941b914d5ac30d42cad982e3f6e846a513ee6a3ce7e" + [[package]] name = "signal-hook" version = "0.3.17" diff --git a/Cargo.toml b/Cargo.toml index be8d2b8..565a8cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,8 +26,10 @@ memchr = "2.7.4" nix = { version = "0.29.0", features = ["signal"] } path-absolutize = "3.1.1" postcard = { version = "1.0.10", default-features = false, features = ["use-std"] } +regex = "1.11.0" serde = { version = "1.0.214", features = ["derive"] } serde_json = "1.0.132" +shell-quote = { version = "0.7.1", default-features = false, features = ["bash"] } signal-hook = { version = "0.3.17", default-features = false } speedate = "0.14.4" thiserror = "1.0.66" diff --git a/DESIGN.md b/DESIGN.md index b34c385..139072a 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -293,5 +293,3 @@ status may take a long time, so it should display a progress bar. - **whole group**: A **submission group** that is identical to the **group** found without applying the additional submission filters. - **workspace**: The location on the file system that contains **directories**. - -# TODO: logo diff --git a/THIRDPARTY.yaml b/THIRDPARTY.yaml index b86c29b..cb73c09 100644 --- a/THIRDPARTY.yaml +++ b/THIRDPARTY.yaml @@ -55,7 +55,7 @@ third_party_libraries: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - package_name: anstream - package_version: 0.6.15 + package_version: 0.6.17 repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: @@ -285,7 +285,7 @@ third_party_libraries: limitations under the License. - package_name: anstyle - package_version: 1.0.8 + package_version: 1.0.9 repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: @@ -515,7 +515,7 @@ third_party_libraries: limitations under the License. - package_name: anstyle-parse - package_version: 0.2.5 + package_version: 0.2.6 repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: @@ -750,8 +750,8 @@ third_party_libraries: See the License for the specific language governing permissions and limitations under the License. - package_name: anstyle-query - package_version: 1.1.1 - repository: https://github.com/rust-cli/anstyle + package_version: 1.1.2 + repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: - license: MIT @@ -980,7 +980,7 @@ third_party_libraries: limitations under the License. - package_name: anstyle-wincon - package_version: 3.0.4 + package_version: 3.0.6 repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: @@ -2661,8 +2661,8 @@ third_party_libraries: limitations under the License. - package_name: colorchoice - package_version: 1.0.2 - repository: https://github.com/rust-cli/anstyle + package_version: 1.0.3 + repository: https://github.com/rust-cli/anstyle.git license: MIT OR Apache-2.0 licenses: - license: MIT @@ -4638,7 +4638,7 @@ third_party_libraries: - license: Apache-2.0 text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: libc - package_version: 0.2.159 + package_version: 0.2.161 repository: https://github.com/rust-lang/libc license: MIT OR Apache-2.0 licenses: @@ -4971,7 +4971,7 @@ third_party_libraries: - license: MIT text: NOT FOUND - package_name: once_cell - package_version: 1.20.1 + package_version: 1.20.2 repository: https://github.com/matklad/once_cell license: MIT OR Apache-2.0 licenses: @@ -5277,7 +5277,7 @@ third_party_libraries: - license: Apache-2.0 text: NOT FOUND - package_name: proc-macro2 - package_version: 1.0.86 + package_version: 1.0.89 repository: https://github.com/dtolnay/proc-macro2 license: MIT OR Apache-2.0 licenses: @@ -5693,7 +5693,7 @@ third_party_libraries: END OF TERMS AND CONDITIONS - package_name: regex - package_version: 1.11.0 + package_version: 1.11.1 repository: https://github.com/rust-lang/regex license: MIT OR Apache-2.0 licenses: @@ -5795,7 +5795,7 @@ third_party_libraries: - license: Apache-2.0 text: " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" - package_name: rustversion - package_version: 1.0.17 + package_version: 1.0.18 repository: https://github.com/dtolnay/rustversion license: MIT OR Apache-2.0 licenses: @@ -7064,6 +7064,215 @@ third_party_libraries: See the License for the specific language governing permissions and limitations under the License. +- package_name: shell-quote + package_version: 0.7.1 + repository: https://github.com/allenap/shell-quote + license: Apache-2.0 + licenses: + - license: Apache-2.0 + text: |2 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. - package_name: signal-hook package_version: 0.3.17 repository: https://github.com/vorner/signal-hook @@ -9576,6 +9785,237 @@ third_party_libraries: Copyright (c) Microsoft Corporation. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +- package_name: windows-sys + package_version: 0.59.0 + repository: https://github.com/microsoft/windows-rs + license: MIT OR Apache-2.0 + licenses: + - license: MIT + text: |2 + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE + - license: Apache-2.0 + text: |2 + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) Microsoft Corporation. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/doc/src/SUMMARY.md b/doc/src/SUMMARY.md index 1d632de..9ae989f 100644 --- a/doc/src/SUMMARY.md +++ b/doc/src/SUMMARY.md @@ -8,6 +8,7 @@ - [Tutorial](guide/tutorial/index.md) - [Hello, workflow!](guide/tutorial/hello.md) - [Managing multiple actions](guide/tutorial/multiple.md) + - [Assigning values to directories](guide/tutorial/value.md) - [Grouping directories](guide/tutorial/group.md) - [Submitting jobs manually](guide/tutorial/scheduler.md) - [Requesting resources with row](guide/tutorial/resources.md) diff --git a/doc/src/env.md b/doc/src/env.md index ef10a50..6746fb2 100644 --- a/doc/src/env.md +++ b/doc/src/env.md @@ -6,6 +6,7 @@ | Environment variable | Value | |----------------------|-------| +| `ACTION_WORKSPACE_PATH` | Path to the workspace, relative to the path containing `workflow.toml`. | | `ACTION_CLUSTER` | Name of the cluster the action is executing on. | | `ACTION_NAME` | The name of the action that is executing. | | `ACTION_PROCESSES` | The total number of processes that this action uses. | diff --git a/doc/src/guide/tutorial/.gitignore b/doc/src/guide/tutorial/.gitignore index e44ccab..45c211d 100644 --- a/doc/src/guide/tutorial/.gitignore +++ b/doc/src/guide/tutorial/.gitignore @@ -1,2 +1,3 @@ /hello-workflow /group-workflow +/value-workflow diff --git a/doc/src/guide/tutorial/group-workflow1.toml b/doc/src/guide/tutorial/group-workflow1.toml deleted file mode 100644 index 5b4a65d..0000000 --- a/doc/src/guide/tutorial/group-workflow1.toml +++ /dev/null @@ -1,2 +0,0 @@ -[workspace] -value_file = "value.json" diff --git a/doc/src/guide/tutorial/group.md b/doc/src/guide/tutorial/group.md index 791e695..8faf81e 100644 --- a/doc/src/guide/tutorial/group.md +++ b/doc/src/guide/tutorial/group.md @@ -2,49 +2,30 @@ ## Overview -This section shows how you can assign a **value** to each directory and use that -**value** to form **groups** of directories. Each **job** executes an action's command -on a **group** of directories. - -## Directory values - -So far, this tutorial has demonstrated small toy examples. In practice, any workflow -that you need to execute on a cluster likely has hundreds or thousands of directories - -each with different parameters. You could try to encode these parameters into the -directory names, but *please don't* - it quickly becomes unmanageable. Instead, you -should include a [JSON](https://www.json.org) file in each directory that identifies -its **value**. - -> Note: For pedagogical reasons, this next code block manually creates directory names -> and value files. In practice, you will likely find [signac](../python/signac.md) more -> convenient to work with - it will create the JSON files and directories for you with -> a cleaner syntax. This tutorial will cover **row** ↔ **signac** interoperation in a -> later section. - -Create a new workflow project and place JSON files in each directory: +This section shows how you can use **values** to form **groups** of directories. Each +**job** executes an action's command on a **group** of directories. + +## Initialize a workspace with values + +To demonstrate the capabilities of **groups**, create a workspace with multiple types of +values. The following script follows the same process used in the previous section: + ```bash {{#include group.sh:init}} ``` -The JSON files must all have the same name. Instruct **row** to read these files -with the `workspace.value_file` key in `workflow.toml`: -```toml -{{#include group-workflow1.toml}} -``` +As mentioned previously, `echo` is used here to create a _minimal_ script that you can +execute to follow along. For any serious production work you will likely find [signac] +more convenient to work with. -Once you create a directory with a **value** file, that value **MUST NOT CHANGE**. Think -of it this way: The results of your computations (the final contents of the directory) -are a mathematical *function* of the **value**. When you want to know the results for -another value, *create a new directory with that value!*. **row** assumes this data -model and [caches](../concepts/cache.md) all value files so that it does not need to -read thousands of files every time you execute a **row** command. +[signac]: ../python/signac.md ## Grouping by value -Now that your workspace directories have **values**, you can use those to form -**groups**. Every action in your workflow operates on **groups**. Add entries to the -`action.group.include` array in an action to select which directories to include by -**value**. To see how this works, replace the contents of `workflow.toml` with: +You can use **values** those to form **groups** of **directories**. Every action in +your workflow operates on **groups**. Add entries to the `action.group.include` array +in an action to select which directories to include by **value**. To see how this works, +replace the contents of `workflow.toml` with: ```toml {{#include group-workflow2.toml}} diff --git a/doc/src/guide/tutorial/value-workflow.toml b/doc/src/guide/tutorial/value-workflow.toml new file mode 100644 index 0000000..9306cce --- /dev/null +++ b/doc/src/guide/tutorial/value-workflow.toml @@ -0,0 +1,10 @@ +# ANCHOR: workspace +[workspace] +value_file = "value.json" +# ANCHOR_END: workspace + +# ANCHOR: action +[[action]] +name = "show" +command = 'echo {directory}, seed: {/seed}, pressure: {/pressure}' +# ANCHOR_END: action diff --git a/doc/src/guide/tutorial/value.md b/doc/src/guide/tutorial/value.md new file mode 100644 index 0000000..16020dd --- /dev/null +++ b/doc/src/guide/tutorial/value.md @@ -0,0 +1,85 @@ +# Assigning values to directories + +## Overview + +This section shows how you can assign a **value** to each directory and use a command +**template** to access portions of that value when submitting **actions**. + +## Directory values + +So far, this tutorial has demonstrated small toy examples. In practice, any workflow +that you need to execute on a cluster likely has hundreds or thousands of directories - +each with different parameters. You could try to encode these parameters into the +directory names, but *please don't* - it quickly becomes unmanageable. Instead, you +should include a [JSON] file in each directory that identifies its **value**. + +[JSON]: https://www.json.org + +> Note: For pedagogical reasons, this next code block manually creates directory names +> and value files. In practice, you will likely find [signac] more +> convenient to work with - it will create the JSON files and directories for you with +> a cleaner syntax. This tutorial will cover **row** ↔ **signac** interoperation in a +> later section. + +[signac]: ../python/signac.md + +Create a new workflow project and place JSON files in each directory: +```bash +{{#include value.sh:init}} +``` +The JSON files must all have the same name. Instruct **row** to read these files +with the `workspace.value_file` key in `workflow.toml`: + +```toml +{{#include value-workflow.toml:workspace}} +``` + +Once you create a directory with a **value** file, that value **MUST NOT CHANGE**. Think +of it this way: The results of your computations (the final contents of the directory) +are a mathematical *function* of the **value**. When you want to know the results for +another value, *create a new directory with that value!*. **row** assumes this data +model and [caches] all value files so that it does not need to read thousands of files +every time you execute a **row** command. + +[caches]: ../concepts/cache.md + +## Passing values to commands + +Now that your workspace directories have **values**, you can pass them to your +commands using **template parameters**. You have already used one template parameter: +`{directory}`. Each **template parameter** name is surrounded by curly braces. + +[JSON] files store a (possibly nested) key/value mapping. Use a [*JSON pointer*] to +reference a portion of the directory's value by placing the [*JSON pointer*] between +curly braces. Add the following section to `workflow.toml` that uses **template +parameters** in the action's `command`: + +```toml +{{#include value-workflow.toml:action}} +``` + +[*JSON pointer*]: ../concepts/json-pointers.md + +Execute the following (and answer yes at the prompt): +```bash +{{#include value.sh:submit}} +``` + +You should see: +```plaintext +directory1, seed: 0, pressure: 1.5 +directory2, seed: 1, pressure: 1.5 +directory3, seed: 0, pressure: 2.1 +directory4, seed: 1, pressure: 2.1 +``` + +Consider how you would use this for your own workflows. For example: +```toml +command = './application -s {/seed} -p {/pressure} -o workspace/{directory}/out' +``` + +# Next steps + +You have now assigned **values** to each **directory** in the workspace and learned +how you can use these **values** with **template parameters** in the **command**. The +next section will show you how to use **values** to form **groups**. diff --git a/doc/src/guide/tutorial/value.sh b/doc/src/guide/tutorial/value.sh new file mode 100644 index 0000000..34fc832 --- /dev/null +++ b/doc/src/guide/tutorial/value.sh @@ -0,0 +1,19 @@ + +# ANCHOR: init +row init value-workflow +cd value-workflow/workspace + +mkdir directory1 && echo '{"seed": 0, "pressure": 1.5}' > directory1/value.json +mkdir directory2 && echo '{"seed": 1, "pressure": 1.5}' > directory2/value.json +mkdir directory3 && echo '{"seed": 0, "pressure": 2.1}' > directory3/value.json +mkdir directory4 && echo '{"seed": 1, "pressure": 2.1}' > directory4/value.json + +# ANCHOR_END: init + +cd .. + +cp ../value-workflow.toml workflow.toml + +# ANCHOR: submit +row submit +# ANCHOR_END: submit diff --git a/doc/src/release-notes.md b/doc/src/release-notes.md index b036726..a63f60d 100644 --- a/doc/src/release-notes.md +++ b/doc/src/release-notes.md @@ -1,5 +1,23 @@ # Release notes +## 0.4.0 (not yet released) + +*Highlights:* + +*Added:* + +* In job scripts, set the environment variable `ACTION_WORKSPACE_PATH` to the _relative_ + path to the current workspace. +* `{workspace_path}` template parameter in `action.command` - replaced with the + _relative_ path to the current workspace. +* `{/JSON pointer}` template parameter in `action.command` - replaced with the portion + of the directory's value referenced by the given JSON pointer. + +*Fixed:* + +* All user-provided content (directories, action names, cluster names, and values) are + properly escaped in the bash script output. + ## 0.3.1 (2024-10-04) *Changed:* diff --git a/doc/src/workflow/action/index.md b/doc/src/workflow/action/index.md index 96b1fa4..e6a9a45 100644 --- a/doc/src/workflow/action/index.md +++ b/doc/src/workflow/action/index.md @@ -65,6 +65,27 @@ or chain the steps with `&&`. For example: command = "echo Message && python action.py {directory}" ``` +### Template parameters + +`action.command` will expand any template parameter contained within curly braces: +`{template_parameter}`. + +* `{directory}` and `{directories}` are described above. +* `{workspace_path}` will be replaced with the _relative_ path from the project root + (the directory containing `workflow.toml`) to the currently selected workspace. +* `{/JSON pointer}` will be replaced by a portion of the directory's value referenced + by the given [JSON pointer]. Must be used with `{directory}`. +* `{}` will be replaced by the entire directory value formatted in JSON as a single + command line argument. Must be used with `{directory}` +* All other template parameters are invalid. + +For example: +```toml +command = "application -p {/pressure} -s {/seed} -o {workspace_path}/{directory}/out" +``` + +[JSON pointer]: ../../guide/concepts/json-pointers.md + ## launchers `action.launchers`: **array** of **strings** - The launchers to apply when executing a diff --git a/src/cli/submit.rs b/src/cli/submit.rs index 7335134..2460bc4 100644 --- a/src/cli/submit.rs +++ b/src/cli/submit.rs @@ -170,7 +170,12 @@ pub fn submit( info!("Execute without --dry-run to submit the following scripts..."); for (index, (action, directories)) in action_directories.iter().enumerate() { info!("Script {}/{}:", index + 1, action_directories.len()); - let script = scheduler.make_script(action, directories)?; + let script = scheduler.make_script( + action, + directories, + &project.workflow().workspace.path, + project.state().values(), + )?; write!(output, "{script}")?; output.flush()?; @@ -264,6 +269,8 @@ pub fn submit( &project.workflow().root, action, directories, + &project.workflow().workspace.path, + project.state().values(), Arc::clone(&should_terminate), ); diff --git a/src/lib.rs b/src/lib.rs index ce5ff8e..eabb658 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -148,6 +148,14 @@ pub enum Error { #[error("Duplicate actions '{0}' must have the same `previous_actions`.")] DuplicateActionsDifferentPreviousActions(String), + #[error( + r"Action '{0}' must use {{directory}} instead of {{directories}} with {{\JSON pointer}}." + )] + DirectoriesUsedWithJSONPointer(String), + + #[error("Unable to parse template '{1}' for action '{0}'.")] + InvalidTemplate(String, String), + // submission errors #[error("Error encountered while executing action '{0}': {1}.")] ExecuteAction(String, String), diff --git a/src/scheduler.rs b/src/scheduler.rs index 6f2c8d6..6695c2b 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -4,7 +4,8 @@ pub mod bash; pub mod slurm; -use std::collections::HashSet; +use serde_json::Value; +use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; use std::sync::atomic::AtomicBool; use std::sync::Arc; @@ -14,44 +15,61 @@ use crate::Error; /// A `Scheduler` creates and submits job scripts. pub trait Scheduler { - /// Make a job script given an `Action` and a list of directories. - /// - /// Useful for showing the script that would be submitted to the user. - /// - /// # Returns - /// A `String` containing the job script. - /// - /// # Errors - /// Returns `Err` when the script cannot be created. - /// - fn make_script(&self, action: &Action, directories: &[PathBuf]) -> Result; + /** Make a job script given an `Action` and a list of directories. - /// Submit a job to the scheduler. - /// - /// # Arguments - /// * `working_directory`: The working directory the action should be submitted from. - /// * `action`: The action to submit. - /// * `directories`: The directories to include in the submission. - /// * `should_terminate`: Set to true when the user terminates the process. - /// - /// # Returns - /// `Ok(job_id_option)` on success. - /// Schedulers that queue jobs should set `job_id_option = Some(job_id)`. - /// Schedulers that execute jobs immediately should set `job_id_option = None`. - /// - /// # Early termination. - /// Implementations should periodically check `should_terminate` and - /// exit early (if possible) with `Err(Error::Interrupted)` when set. - /// - /// # Errors - /// Returns `Err(row::Error)` on error, which may be due to a non-zero exit - /// status from the submission. - /// + # Arguments + * `action`: The action to submit. + * `directories`: The directories to include in the submission. + * `workspace_path`: The relative path to the workspace directory from the workflow root. + * `directory_values`: Maps directory names to JSON values. + + `make_script` must use expand `{workspace_path`} and `{\JSON pointer}` + templates in the action's command. + + # Returns + A `String` containing the job script. + + # Errors + Returns `Err` when the script cannot be created. + */ + fn make_script( + &self, + action: &Action, + directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, + ) -> Result; + + /** Submit a job to the scheduler. + + # Arguments + * `workflow_root`: The working directory the action should be submitted from. + * `action`: The action to submit. + * `directories`: The directories to include in the submission. + * `workspace_path`: The relative path to the workspace directory from the workflow root. + * `directory_values`: Maps directory names to JSON values. + * `should_terminate`: Set to true when the user terminates the process. + + # Returns + `Ok(job_id_option)` on success. + Schedulers that queue jobs should set `job_id_option = Some(job_id)`. + Schedulers that execute jobs immediately should set `job_id_option = None`. + + # Early termination. + Implementations should periodically check `should_terminate` and + exit early (if possible) with `Err(Error::Interrupted)` when set. + + # Errors + Returns `Err(row::Error)` on error, which may be due to a non-zero exit + status from the submission. + */ fn submit( &self, - working_directory: &Path, + workflow_root: &Path, action: &Action, directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, should_terminate: Arc, ) -> Result, Error>; diff --git a/src/scheduler/bash.rs b/src/scheduler/bash.rs index 0fb3fd9..7bae31b 100644 --- a/src/scheduler/bash.rs +++ b/src/scheduler/bash.rs @@ -4,6 +4,9 @@ use log::{debug, error, trace}; use nix::sys::signal::{self, Signal}; use nix::unistd::Pid; +use regex::{Captures, Regex}; +use serde_json::Value; +use shell_quote::{Quote, QuoteExt}; use std::collections::{HashMap, HashSet}; use std::env; use std::fmt::Write as _; @@ -29,6 +32,8 @@ pub(crate) struct BashScriptBuilder<'a> { cluster_name: &'a str, action: &'a Action, directories: &'a [PathBuf], + workspace_path: &'a Path, + directory_values: &'a HashMap, preamble: &'a str, launchers: &'a HashMap, } @@ -39,6 +44,8 @@ impl<'a> BashScriptBuilder<'a> { cluster_name: &'a str, action: &'a Action, directories: &'a [PathBuf], + workspace_path: &'a Path, + directory_values: &'a HashMap, launchers: &'a HashMap, ) -> Self { let walltime_in_minutes = action @@ -53,6 +60,8 @@ impl<'a> BashScriptBuilder<'a> { cluster_name, action, directories, + workspace_path, + directory_values, preamble: "", launchers, } @@ -78,26 +87,32 @@ impl<'a> BashScriptBuilder<'a> { fn variables(&self) -> Result { let mut result = "directories=(\n".to_string(); for directory in self.directories { - result.push('\''); - result.push_str( + result.push_quoted( + shell_quote::Bash, directory .to_str() .ok_or_else(|| Error::NonUTF8DirectoryName(directory.clone()))?, ); - result.push_str("'\n"); + result.push('\n'); } result.push_str(")\n"); let _ = write!( result, r#" -export ACTION_CLUSTER="{}" -export ACTION_NAME="{}" -export ACTION_PROCESSES="{}" -export ACTION_WALLTIME_IN_MINUTES="{}" +export ACTION_WORKSPACE_PATH={} +export ACTION_CLUSTER={} +export ACTION_NAME={} +export ACTION_PROCESSES={} +export ACTION_WALLTIME_IN_MINUTES={} "#, - self.cluster_name, - self.action.name(), + >::quote( + self.workspace_path + .to_str() + .ok_or_else(|| Error::NonUTF8DirectoryName(self.workspace_path.into()))? + ), + >::quote(self.cluster_name), + >::quote(self.action.name()), self.total_processes, self.walltime_in_minutes, ); @@ -106,22 +121,19 @@ export ACTION_WALLTIME_IN_MINUTES="{}" { let _ = writeln!( result, - "export ACTION_PROCESSES_PER_DIRECTORY=\"{processes_per_directory}\"", + "export ACTION_PROCESSES_PER_DIRECTORY={processes_per_directory}", ); } if let Some(threads_per_process) = self.action.resources.threads_per_process { let _ = writeln!( result, - "export ACTION_THREADS_PER_PROCESS=\"{threads_per_process}\"", + "export ACTION_THREADS_PER_PROCESS={threads_per_process}", ); } if let Some(gpus_per_process) = self.action.resources.gpus_per_process { - let _ = writeln!( - result, - "export ACTION_GPUS_PER_PROCESS=\"{gpus_per_process}\"", - ); + let _ = writeln!(result, "export ACTION_GPUS_PER_PROCESS={gpus_per_process}",); } Ok(result) @@ -158,13 +170,20 @@ trap 'printf %s\\n "${{directories[@]}}" | {row_executable} scan --no-progress - } fn execution(&self) -> Result { - let contains_directory = self.action.command().contains("{directory}"); - let contains_directories = self.action.command().contains("{directories}"); + let command = self.action.command(); + + let contains_directory = command.contains("{directory}"); + let contains_directories = command.contains("{directories}"); if contains_directory && contains_directories { return Err(Error::ActionContainsMultipleTemplates( self.action.name().into(), )); } + if contains_directories && self.contains_json_pointer() { + return Err(Error::DirectoriesUsedWithJSONPointer( + self.action.name().into(), + )); + } // Build up launcher prefix let mut launcher_prefix = String::new(); @@ -191,20 +210,44 @@ trap 'printf %s\\n "${{directories[@]}}" | {row_executable} scan --no-progress - } if contains_directory { - let command = self.action.command().replace("{directory}", "$directory"); - Ok(format!( - r#" + if self.contains_json_pointer() { + // When JSON pointers are present, produce one line per directory. + let mut result = String::with_capacity(128 * self.directories.len()); + for directory in self.directories { + let current_command = self.substitute(command, directory)?; + let _ = writeln!( + result, + r#" +{launcher_prefix}{current_command} || {{ >&2 echo "[ERROR row::action] Error executing command."; exit 2; }} +"# + ); + } + + Ok(result) + } else { + // When there are no JSON pointers, use a compact for loop. + let command = command.replace("{directory}", "$directory"); + let command = self.substitute(&command, Path::new(""))?; + Ok(format!( + r#" for directory in "${{directories[@]}}" do {launcher_prefix}{command} || {{ >&2 echo "[ERROR row::action] Error executing command."; exit 2; }} done "# - )) + )) + } } else if contains_directories { - let command = self - .action - .command() - .replace("{directories}", r#""${directories[@]}""#); + // {directories} is compatible with {workspace_path}, but not {/JSON pointer} + let command = command.replace("{directories}", r#""${directories[@]}""#); + let command = command.replace( + "{workspace_path}", + &>::quote( + self.workspace_path + .to_str() + .ok_or_else(|| Error::NonUTF8DirectoryName(self.workspace_path.into()))?, + ), + ); Ok(format!( r#" {launcher_prefix}{command} || {{ >&2 echo "[row] Error executing command."; exit 1; }} @@ -218,6 +261,64 @@ done pub(crate) fn build(&self) -> Result { Ok(self.header() + &self.variables()? + &self.setup()? + &self.execution()?) } + + /// Check if the command uses JSON pointers. + fn contains_json_pointer(&self) -> bool { + self.action.command().contains("{}") || self.action.command().contains("{/") + } + + /** Substitute all template strings in a given command. + + Substitutes `{workspace_path}` with the value of `workspace_path`. + Substitutes `{\JSON pointer}` with the value of the JSON pointer for the given directory. + + # Errors + + * `Err(row::JSONPointerNotFound)` when a JSON pointer named in `command` is not present + in the values for the given directory. + * `Err(row::InvalidTemplate)` when an unexpected name appears between `{` and `}`. + */ + fn substitute(&self, command: &str, directory: &Path) -> Result { + let replacement = |caps: &Captures| -> Result { + match &caps[0] { + "{workspace_path}" => Ok(shell_quote::Bash::quote( + self.workspace_path + .to_str() + .ok_or_else(|| Error::NonUTF8DirectoryName(self.workspace_path.into()))?, + )), + "{directory}" => { + Ok(shell_quote::Bash::quote(directory.to_str().ok_or_else( + || Error::NonUTF8DirectoryName(self.workspace_path.into()), + )?)) + } + template if template.starts_with("{/") || template == "{}" => { + let pointer = caps[1].into(); + let value = self + .directory_values + .get(directory) + .ok_or_else(|| Error::DirectoryNotFound(directory.into()))? + .pointer(pointer) + .ok_or_else(|| { + Error::JSONPointerNotFound(directory.into(), pointer.to_string()) + })?; + + match value { + // Value::to_string puts extra double quotes around JSON strings, + // extract the string itself. + Value::String(s) => Ok(>::quote(s)), + _ => Ok(shell_quote::Bash::quote(&value.to_string())), + } + } + _ => Err(Error::InvalidTemplate( + self.action.name().into(), + caps[0].into(), + )), + } + }; + + let regex = Regex::new(r"\{([^\}]*)\}").expect("valid regular expression"); + replace_all(®ex, command, replacement) + } } /// The `Bash` scheduler constructs bash scripts and executes them with `bash`. @@ -236,23 +337,39 @@ impl Bash { pub struct ActiveBashJobs {} impl Scheduler for Bash { - fn make_script(&self, action: &Action, directories: &[PathBuf]) -> Result { - BashScriptBuilder::new(&self.cluster.name, action, directories, &self.launchers).build() + fn make_script( + &self, + action: &Action, + directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, + ) -> Result { + BashScriptBuilder::new( + &self.cluster.name, + action, + directories, + workspace_path, + directory_values, + &self.launchers, + ) + .build() } fn submit( &self, - working_directory: &Path, + workflow_root: &Path, action: &Action, directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, should_terminate: Arc, ) -> Result, Error> { debug!("Executing '{}' in bash.", action.name()); - let script = self.make_script(action, directories)?; + let script = self.make_script(action, directories, workspace_path, directory_values)?; let mut child = Command::new("bash") .stdin(Stdio::piped()) - .current_dir(working_directory) + .current_dir(workflow_root) .spawn() .map_err(|e| Error::SpawnProcess("bash".into(), e))?; @@ -308,9 +425,33 @@ impl ActiveJobs for ActiveBashJobs { } } +/** Fallible `replace_all`. + +From [the regex documentation]. + +[the regex documentation]: https://docs.rs/regex/latest/regex/struct.Regex.html#fallibility +*/ +fn replace_all( + re: &Regex, + haystack: &str, + replacement: impl Fn(&Captures) -> Result, +) -> Result { + let mut new = String::with_capacity(haystack.len()); + let mut last_match = 0; + for caps in re.captures_iter(haystack) { + let m = caps.get(0).unwrap(); + new.push_str(&haystack[last_match..m.start()]); + new.push_str(&replacement(&caps)?); + last_match = m.end(); + } + new.push_str(&haystack[last_match..]); + Ok(new) +} + #[cfg(test)] mod tests { use super::*; + use serde_json::json; use serial_test::parallel; use speedate::Duration; @@ -347,9 +488,16 @@ mod tests { #[parallel] fn header() { let (action, directories, launchers) = setup(); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.starts_with("#!/bin/bash")); @@ -359,10 +507,17 @@ mod tests { #[parallel] fn preamble() { let (action, directories, launchers) = setup(); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .with_preamble("#preamble") - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .with_preamble("#preamble") + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains("#preamble\n")); @@ -372,9 +527,16 @@ mod tests { #[parallel] fn no_setup() { let (action, directories, launchers) = setup(); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(!script.contains("test $? -eq 0 ||")); @@ -388,16 +550,30 @@ mod tests { .submit_options .insert("cluster".to_string(), SubmitOptions::default()); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(!script.contains("test $? -eq 0 ||")); action.submit_options.get_mut("cluster").unwrap().setup = Some("my setup".to_string()); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains("my setup")); assert!(script.contains("test $? -eq 0 ||")); @@ -407,9 +583,16 @@ mod tests { #[parallel] fn execution_directory() { let (action, directories, launchers) = setup(); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains("command $directory")); @@ -421,9 +604,16 @@ mod tests { let (mut action, directories, launchers) = setup(); action.command = Some("command {directories}".to_string()); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains("command \"${directories[@]}\"")); @@ -437,9 +627,16 @@ mod tests { action.launchers = Some(vec!["openmp".into()]); action.command = Some("command {directories}".to_string()); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains("OMP_NUM_THREADS=4 command \"${directories[@]}\"")); @@ -452,9 +649,16 @@ mod tests { action.launchers = Some(vec!["mpi".into()]); action.command = Some("command {directories}".to_string()); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); assert!(script.contains( @@ -468,7 +672,15 @@ mod tests { let (mut action, directories, launchers) = setup(); action.command = Some("command {directory} {directories}".to_string()); - let result = BashScriptBuilder::new("cluster", &action, &directories, &launchers).build(); + let result = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build(); assert!(matches!( result, @@ -477,7 +689,15 @@ mod tests { action.command = Some("command".to_string()); - let result = BashScriptBuilder::new("cluster", &action, &directories, &launchers).build(); + let result = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build(); assert!(matches!( result, @@ -489,19 +709,26 @@ mod tests { #[parallel] fn variables() { let (action, directories, launchers) = setup(); - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); - assert!(script.contains("export ACTION_CLUSTER=\"cluster\"\n")); - assert!(script.contains("export ACTION_NAME=\"action\"\n")); - assert!(script.contains("export ACTION_PROCESSES=\"6\"\n")); - assert!(script.contains("export ACTION_WALLTIME_IN_MINUTES=\"4\"\n")); - assert!(script.contains("export ACTION_PROCESSES_PER_DIRECTORY=\"2\"\n")); - assert!(script.contains("export ACTION_THREADS_PER_PROCESS=\"4\"\n")); - assert!(script.contains("export ACTION_GPUS_PER_PROCESS=\"1\"\n")); + assert!(script.contains("export ACTION_CLUSTER=cluster\n")); + assert!(script.contains("export ACTION_NAME=action\n")); + assert!(script.contains("export ACTION_PROCESSES=6\n")); + assert!(script.contains("export ACTION_WALLTIME_IN_MINUTES=4\n")); + assert!(script.contains("export ACTION_PROCESSES_PER_DIRECTORY=2\n")); + assert!(script.contains("export ACTION_THREADS_PER_PROCESS=4\n")); + assert!(script.contains("export ACTION_GPUS_PER_PROCESS=1\n")); } #[test] @@ -515,16 +742,23 @@ mod tests { action.resources.threads_per_process = None; action.resources.gpus_per_process = None; - let script = BashScriptBuilder::new("cluster", &action, &directories, &launchers) - .build() - .expect("Valid script."); + let script = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build() + .expect("Valid script."); println!("{script}"); - assert!(script.contains("export ACTION_CLUSTER=\"cluster\"\n")); - assert!(script.contains("export ACTION_NAME=\"action\"\n")); - assert!(script.contains("export ACTION_PROCESSES=\"10\"\n")); - assert!(script.contains("export ACTION_WALLTIME_IN_MINUTES=\"3\"\n")); + assert!(script.contains("export ACTION_CLUSTER=cluster\n")); + assert!(script.contains("export ACTION_NAME=action\n")); + assert!(script.contains("export ACTION_PROCESSES=10\n")); + assert!(script.contains("export ACTION_WALLTIME_IN_MINUTES=3\n")); assert!(!script.contains("export ACTION_PROCESSES_PER_DIRECTORY")); assert!(!script.contains("export ACTION_THREADS_PER_PROCESS")); assert!(!script.contains("export ACTION_GPUS_PER_PROCESS")); @@ -542,7 +776,7 @@ mod tests { submit_options: Vec::new(), }; let script = Bash::new(cluster, launchers) - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("Valid script"); println!("{script}"); @@ -556,7 +790,15 @@ mod tests { action.launchers = Some(vec![]); action.command = Some("command {directories}".to_string()); - let result = BashScriptBuilder::new("cluster", &action, &directories, &launchers).build(); + let result = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build(); assert!(matches!(result, Err(Error::NoProcessLauncher(_, _)))); } @@ -569,8 +811,204 @@ mod tests { action.launchers = Some(vec!["mpi".into(), "mpi".into()]); action.command = Some("command {directories}".to_string()); - let result = BashScriptBuilder::new("cluster", &action, &directories, &launchers).build(); + let result = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &PathBuf::default(), + &HashMap::new(), + &launchers, + ) + .build(); assert!(matches!(result, Err(Error::TooManyProcessLaunchers(_)))); } + + #[test] + #[parallel] + fn invalid_template_without_pointer() { + let (mut action, directories, launchers) = setup(); + action.command = Some(r"command {directory} {invalid}".to_string()); + let workspace_path = PathBuf::from("workspace_path/test"); + let directory_values = HashMap::new(); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(!builder.contains_json_pointer()); + + let result = builder.build(); + + assert!(matches!(result, Err(Error::InvalidTemplate(_, _)))); + } + + #[test] + #[parallel] + fn invalid_template_with_pointer() { + let (mut action, directories, launchers) = setup(); + action.command = Some(r"command {directory} {invalid} {/pointer}".to_string()); + let workspace_path = PathBuf::from("workspace_path/test"); + let directory_values = HashMap::new(); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(builder.contains_json_pointer()); + + let result = builder.build(); + + assert!(matches!(result, Err(Error::InvalidTemplate(_, _)))); + } + + #[test] + #[parallel] + fn workspace_path_without_pointer() { + let (mut action, directories, launchers) = setup(); + action.command = Some(r"command {directory} {workspace_path}".to_string()); + let workspace_path = PathBuf::from("test/path"); + let directory_values = HashMap::new(); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(!builder.contains_json_pointer()); + + let script = builder.build().expect("valid script"); + + println!("{script}"); + + assert!(script.contains("export ACTION_WORKSPACE_PATH=test/path\n")); + assert!(script.contains("command $directory test/path")); + + // Test again with a path that requires escaping + let workspace_path = PathBuf::from("test $path"); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(!builder.contains_json_pointer()); + + let script = builder.build().expect("valid script"); + + println!("{script}"); + + assert!(script.contains("export ACTION_WORKSPACE_PATH=$'test $path'\n")); + assert!(script.contains("command $directory $'test $path'")); + } + + #[test] + #[parallel] + fn workspace_path_with_directories() { + let (mut action, directories, launchers) = setup(); + action.command = Some(r"command {directories} {workspace_path}".to_string()); + let workspace_path = PathBuf::from("test_path"); + let directory_values = HashMap::new(); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(!builder.contains_json_pointer()); + + let script = builder.build().expect("valid script"); + + println!("{script}"); + + assert!(script.contains("export ACTION_WORKSPACE_PATH=test_path\n")); + assert!(script.contains(r#"command "${directories[@]}" test_path"#)); + + // Test again with a path that requires escaping + let workspace_path = PathBuf::from("test $path"); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(!builder.contains_json_pointer()); + + let script = builder.build().expect("valid script"); + + println!("{script}"); + + assert!(script.contains("export ACTION_WORKSPACE_PATH=$'test $path'\n")); + assert!(script.contains(r#"command "${directories[@]}" $'test $path'"#)); + } + + #[test] + #[parallel] + fn workspace_path_with_json_pointers() { + let (mut action, directories, launchers) = setup(); + action.command = Some( + r"command {directory} {workspace_path} {/value} {/name} {/valid} {/array} {}" + .to_string(), + ); + let workspace_path = PathBuf::from("test $path"); + let mut directory_values = HashMap::new(); + directory_values.insert( + PathBuf::from("a"), + json!({"value": 1, "name": "directory_a", "valid": true, "array": [1,2,3]}), + ); + directory_values.insert( + PathBuf::from("b"), + json!({"value": 5, "name": "directory_b", "valid": false, "array": [4,5,6]}), + ); + directory_values.insert( + PathBuf::from("c"), + json!({"value": 7, "name": "directory_c", "valid": null, "array": [7,8,9]}), + ); + + let builder = BashScriptBuilder::new( + "cluster", + &action, + &directories, + &workspace_path, + &directory_values, + &launchers, + ); + + assert!(builder.contains_json_pointer()); + + let script = builder.build().expect("valid script"); + + println!("{script}"); + + assert!(script.contains("export ACTION_WORKSPACE_PATH=$'test $path'\n")); + assert!(script.contains("command a $'test $path' 1 directory_a true $'[1,2,3]'")); + assert!(script.contains("command b $'test $path' 5 directory_b false $'[4,5,6]'")); + assert!(script.contains("command c $'test $path' 7 directory_c null $'[7,8,9]'")); + } } diff --git a/src/scheduler/slurm.rs b/src/scheduler/slurm.rs index 859e9a5..c80127c 100644 --- a/src/scheduler/slurm.rs +++ b/src/scheduler/slurm.rs @@ -2,6 +2,7 @@ // Part of row, released under the BSD 3-Clause License. use log::{debug, error, trace}; +use serde_json::Value; use std::collections::{HashMap, HashSet}; use std::fmt::Write as _; use std::io::Write; @@ -41,7 +42,13 @@ pub struct ActiveSlurmJobs { } impl Scheduler for Slurm { - fn make_script(&self, action: &Action, directories: &[PathBuf]) -> Result { + fn make_script( + &self, + action: &Action, + directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, + ) -> Result { let mut preamble = String::with_capacity(512); let mut user_partition = &None; @@ -134,16 +141,25 @@ impl Scheduler for Slurm { } } - BashScriptBuilder::new(&self.cluster.name, action, directories, &self.launchers) - .with_preamble(&preamble) - .build() + BashScriptBuilder::new( + &self.cluster.name, + action, + directories, + workspace_path, + directory_values, + &self.launchers, + ) + .with_preamble(&preamble) + .build() } fn submit( &self, - working_directory: &Path, + workflow_root: &Path, action: &Action, directories: &[PathBuf], + workspace_path: &Path, + directory_values: &HashMap, should_terminate: Arc, ) -> Result, Error> { debug!("Submtitting '{}' with sbatch.", action.name()); @@ -158,13 +174,13 @@ impl Scheduler for Slurm { return Err(Error::Interrupted); } - let script = self.make_script(action, directories)?; + let script = self.make_script(action, directories, workspace_path, directory_values)?; let mut child = Command::new("sbatch") .stdin(Stdio::piped()) .stdout(Stdio::piped()) .arg("--parsable") - .current_dir(working_directory) + .current_dir(workflow_root) .spawn() .map_err(|e| Error::SpawnProcess("sbatch".into(), e))?; @@ -316,7 +332,7 @@ mod tests { fn default() { let (action, directories, slurm) = setup(); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -336,7 +352,7 @@ mod tests { slurm.cluster.submit_options = vec!["--option=value".to_string()]; let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -358,7 +374,7 @@ mod tests { action.resources.processes = Some(Processes::PerDirectory(3)); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -379,7 +395,7 @@ mod tests { ); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -400,7 +416,7 @@ mod tests { ); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -416,7 +432,7 @@ mod tests { action.resources.threads_per_process = Some(5); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -431,7 +447,7 @@ mod tests { action.resources.gpus_per_process = Some(5); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -458,7 +474,7 @@ mod tests { let slurm = Slurm::new(cluster, launchers.by_cluster("cluster")); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -487,7 +503,7 @@ mod tests { action.resources.gpus_per_process = Some(1); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -516,7 +532,7 @@ mod tests { action.resources.processes = Some(Processes::PerSubmission(81)); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}"); @@ -546,7 +562,7 @@ mod tests { action.resources.gpus_per_process = Some(1); let script = slurm - .make_script(&action, &directories) + .make_script(&action, &directories, &PathBuf::default(), &HashMap::new()) .expect("valid script"); println!("{script}");