From f0891923b17595045f6a949991ebb86af008d1be Mon Sep 17 00:00:00 2001 From: Daniel Neilson <53624638+ddneilson@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:22:43 -0600 Subject: [PATCH] feat: adding an initial set of sample templates (#25) Summary: We are providing some sample Job/Environment Templates that users can reference to demonstrate the sorts of things that can be done with Open Job Description. This seeds an initial set of templates. Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com> --- .github/workflows/check_samples.yml | 58 +++++ CONTRIBUTING.md | 4 +- README.md | 58 +++-- samples/LICENSE | 175 +++++++++++++ samples/README.md | 40 +++ samples/sample-template.yaml | 23 ++ .../environment_templates/python-venv.yaml | 60 +++++ .../job_templates/algorithmic-art.yaml | 194 ++++++++++++++ .../job_templates/blender-ffmpeg.yaml | 148 +++++++++++ samples/v2023-09/job_templates/ffmpeg.yaml | 210 ++++++++++++++++ .../job_templates/host-requirements.yaml | 75 ++++++ .../job_templates/scripts/algorithmic-art.py | 84 +++++++ .../job_templates/stdout-messages.yaml | 55 ++++ .../job_templates/ui-controls-showcase.yaml | 236 ++++++++++++++++++ wiki/2023-09:-Template-Schemas.md | 2 +- wiki/Home.md | 22 +- 16 files changed, 1423 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/check_samples.yml create mode 100644 samples/LICENSE create mode 100644 samples/README.md create mode 100644 samples/sample-template.yaml create mode 100644 samples/v2023-09/environment_templates/python-venv.yaml create mode 100644 samples/v2023-09/job_templates/algorithmic-art.yaml create mode 100644 samples/v2023-09/job_templates/blender-ffmpeg.yaml create mode 100644 samples/v2023-09/job_templates/ffmpeg.yaml create mode 100644 samples/v2023-09/job_templates/host-requirements.yaml create mode 100644 samples/v2023-09/job_templates/scripts/algorithmic-art.py create mode 100644 samples/v2023-09/job_templates/stdout-messages.yaml create mode 100644 samples/v2023-09/job_templates/ui-controls-showcase.yaml diff --git a/.github/workflows/check_samples.yml b/.github/workflows/check_samples.yml new file mode 100644 index 0000000..cf8ab4a --- /dev/null +++ b/.github/workflows/check_samples.yml @@ -0,0 +1,58 @@ +name: Validate Samples + +on: + pull_request: + branches: [ mainline ] + paths: + - samples/** + +jobs: + CopyrightHeader: + name: Copyright Header + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check Header + run: | + set -eou pipefail + EXPECTED_HEADER="# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved." + for f in $(find samples/ -name '*.yaml') + do + echo "Checking: $f" + if test "$(head -n 1 $f)" != "${EXPECTED_HEADER}" + then + echo "ERROR: Copyright header missing on file: $f" + exit 1 + fi + done + + TemplateValidation: + name: Check template syntax + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install openjd-cli + run: | + pip install --upgrade pip + pip install openjd-cli + + - name: Run check + run: | + set -eou pipefail + for f in $(find samples/v2023-09/ -name '*.yaml') + do + echo "Checking: $f" + openjd check $f + if test $? -ne 0 + then + echo "Failed check" + exit 1 + fi + done diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0201a62..bb2a45d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,8 @@ know that, as currently specified, Open Job Description is not a cure-all for an * [Issues](https://github.com/OpenJobDescription/openjd-specifications/issues): We encourage you to use the GitHub issue tracker to report bugs. * [Pull Requests](https://github.com/OpenJobDescription/openjd-specifications/pulls): - We welcome pull requests to improve this wiki documentation. Simply make your changes in our [GitHub Repository](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/wiki) - and post a pull request. + We welcome pull requests to improve the wiki documentation and add sample templates. Simply make your changes in + our [GitHub Repository](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/wiki) and post a pull request. Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution. diff --git a/README.md b/README.md index f93227e..834b521 100644 --- a/README.md +++ b/README.md @@ -7,33 +7,57 @@ and to drive updates from the community. Jump to: * [Wiki Home](https://github.com/OpenJobDescription/openjd-specifications/wiki) +* [Sample Templates](samples/README.md) * [RFC Readme](rfcs/README.md) ## Getting Started -The fastest way to understand the bones of Open Job Description is to understand both [How Jobs Are Constructed](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Constructed) +The fastest way to understand the bones of Open Job Description is to understand both +[How Jobs Are Constructed](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Constructed) and [How Jobs Are Run](https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run). +You may also find it beneficial to look through the provided +[sample templates](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/samples) in this GitHub +repository. ## What is Open Job Description? -Open Job Description is a flexible open specification for defining render -jobs which are portable between studios and render solutions. - -We created Open Job Description after hearing frequently from studios that they -found the choice of render farm management tools to be daunting due to the -effort required to update or replace their tooling around the render farm. We -also heard from software developers that they were unable to realistically -release render farm plugins for their own applications despite being the most -qualified to do so, as the render farm landscape was fractured and releasing -multiple plugins for different render farm solutions would quickly siphon all -their development capacity away from improving their software. A standard way of -defining render jobs, or really any type of work suited for completion on a -render farm, makes tools and plugins portable and increases interoperability. - -For deeper insight into our thought process and goals, we recommend [this Academy Software Foundation talk](https://www.youtube.com/watch?v=3AM3L6P-cAw&list=PL9dZxafYCWmxDFGc2CEq4SgCkZWKYW1m5&index=14) -by Pauline Koh, Senior Product Manager at Amazon Web Services, titled +Open Job Description is a flexible open specification for defining render +jobs which are portable between studios and render solutions. + +We created Open Job Description after hearing frequently from studios that they +found the choice of render farm management tools to be daunting due to the +effort required to update or replace their tooling around the render farm. We +also heard from software developers that they were unable to realistically +release render farm plugins for their own applications despite being the most +qualified to do so, as the render farm landscape was fractured and releasing +multiple plugins for different render farm solutions would quickly siphon all +their development capacity away from improving their software. A standard way of +defining render jobs, or really any type of work suited for completion on a +render farm, makes tools and plugins portable and increases interoperability. + +For deeper insight into our thought process and goals, we recommend +[this Academy Software Foundation talk](https://www.youtube.com/watch?v=3AM3L6P-cAw&list=PL9dZxafYCWmxDFGc2CEq4SgCkZWKYW1m5&index=14) +by Pauline Koh, Senior Product Manager at Amazon Web Services, titled *Portable Jobs for Open Source Content Production*. +## Open Job Description Projects + +*If you have an Open Job Description project that you would like to advertise here then please +submit a pull request.* + +### Tools + +* [openjd-cli](https://github.com/OpenJobDescription/openjd-cli) - Provides a command-line + interface for working with Open Job Description templates. + +### Libraries + +* [openjd-model](https://github.com/OpenJobDescription/openjd-model-for-python) - A Python + implementation of the data model for Open Job Description's template schemas. +* [openjd-sessions](https://github.com/OpenJobDescription/openjd-sessions-for-python) - A Python + library that can be used to build a runtime that is able to run Jobs in a Session as defined + by Open Job Description. + ## Contributing Open Job Description is under active development. We're releasing this because diff --git a/samples/LICENSE b/samples/LICENSE new file mode 100644 index 0000000..67db858 --- /dev/null +++ b/samples/LICENSE @@ -0,0 +1,175 @@ + + 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. diff --git a/samples/README.md b/samples/README.md new file mode 100644 index 0000000..2436301 --- /dev/null +++ b/samples/README.md @@ -0,0 +1,40 @@ +# Open Job Description Sample Templates + +This directory contains a set of sample templates for the Open Job Description standard. +The aim with these is to provide a small sampling of just some of the things that you +can do with Open Job Description, and a reference set of demonstrations of template +concepts that you can incorporate in to your own templates. + +All samples are provided AS-IS. We strongly recommend that you test all samples thoroughly +before use, and customize the samples as required by your individual needs. + +## Contributing + +We encourage and welcome your contributions to this repository. Simply open a pull +request on this repository that includes your sample and a modification to this README +to add your sample to the index. We ask that all contributions be in YAML document format, +and follow the [sample template](./sample-template.yaml). + +Please see the [CONTRIBUTING guide](../CONTRIBUTING.md) for additional information. + +## Samples Index + +### Revision v2023-09 + +| Job Template | Concepts Demonstrated | +| ------ | --------------------- | +| [algorithmic-art](./v2023-09/job_templates/algorithmic-art.yaml) | step environment, step dependencies, task parameter combination, job parameters, path mapping, embedded files, openjd_env, animated video | +| [blender-ffmpeg](./v2023-09/job_templates/blender-ffmpeg.yaml) | step dependencies, embedded files, job parameters, ui metadata | +| [ffmpeg](./v2023-09/job_templates/ffmpeg.yaml) | command arguments, debugging environment, step dependencies, job parameters, ui metadata | +| [host-requirements](./v2023-09/job_templates/host-requirements.yaml) | host requirements | +| [stdout-messages](./v2023-09/job_templates/stdout-messages.yaml) | stdout messages, embedded files | +| [ui-controls-showcase](./v2023-09/job_templates/ui-controls-showcase.yaml) | job parameters, ui metadata, embedded file | + +| Environment Template | Concepts Demonstrated | +| ------ | --------------------- | +| [python-venv](./v2023-09/environment_templates/python-venv.yaml) | environment, openjd_env, embedded file | + +## License + +All templates in this directory and all of its subdirectories are made available +under the terms of the [Apache License 2.0](./LICENSE). diff --git a/samples/sample-template.yaml b/samples/sample-template.yaml new file mode 100644 index 0000000..e45c622 --- /dev/null +++ b/samples/sample-template.yaml @@ -0,0 +1,23 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# A brief description of what this sample is demonstrating that you want to draw +# attention to. +# +# ---- +# Requirements +# ---- +# What, if any, requirements must be met by the host environment to be able +# to run this template. Provide this as a bulleted list. For example +# - Software package X, version x.y.z or higher +# - linux +# - ... etc +# +# ----- +# Contributors to this template: +# + +name: Brief-Descriptive-Title +# ... and so on diff --git a/samples/v2023-09/environment_templates/python-venv.yaml b/samples/v2023-09/environment_templates/python-venv.yaml new file mode 100644 index 0000000..d769ee9 --- /dev/null +++ b/samples/v2023-09/environment_templates/python-venv.yaml @@ -0,0 +1,60 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# Using an Environment Template to create a Python virtual environment +# for your Session to use. Notably, this demonstrates using the `openjd_env` +# stdout message to automatically have the virtual environment activated +# in subsequent actions. +# +# ---- +# Requirements +# ---- +# - bash shell +# - python3 compatible Python installed +# +# ----- +# Contributors to this template: +# Daniel Neilson (https://github.com/ddneilson) + +specificationVersion: environment-2023-09 +environment: + name: PythonVenv + description: > + Creates a Python virtual environment in the Session Working directory, and + ensures that actions that are run while this Environment is active will automatically + be using the virtual environment. + script: + actions: + onEnter: + command: bash + args: [ "{{Env.File.Enter }}" ] + onExit: + command: bash + args: [ "{{Env.File.Exit}}" ] + embeddedFiles: + - name: Enter + type: TEXT + runnable: True + data: | + python3 -m venv .venv + source .venv/bin/activate + pip install --upgrade pip + + # Export the environment variables required to have an activated virtual env. + # Open Job Description intercepts the stdout of all running processes and looks for + # lines starting in "openjd_" as an instruction to the runtime. + # These environment variables will no longer be applied once this environment is exited. + + echo "openjd_env: PATH=${PATH}" + echo "openjd_env: VIRTUAL_ENV=${VIRTUAL_ENV}" + echo "openjd_env: VIRTUAL_ENV_PROMPT=${VIRTUAL_ENV_PROMPT}" + - name: Exit + type: TEXT + runnable: True + data: | + # Delete the virtual environment. + # Not strictly required since the Session Working Directory will be deleted + # at the end of the Session, but included for demonstration. + rm -rf .venv diff --git a/samples/v2023-09/job_templates/algorithmic-art.yaml b/samples/v2023-09/job_templates/algorithmic-art.yaml new file mode 100644 index 0000000..a18d13f --- /dev/null +++ b/samples/v2023-09/job_templates/algorithmic-art.yaml @@ -0,0 +1,194 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# This demonstrates a Job that will render a series of animation frames +# and encode videos from the created frames. Notably, this shows off: +# - Step Environment to create and use an ephemeral Python virtual environment +# in the Session working directory. +# - Using associative combination of Task Parameters to create a wedge-style +# render step where we create multiple animations that differ only in "simulation" +# metaparameters. +# - Step dependencies where the Step to encode videos must wait for the rendering +# Step to complete before it can run. +# - The use of embedded files +# - Job parameters; including path-typed parameters. +# - Path mapping a workstation path to a render-host path. +# +# Run with: +# mkdir outputs +# openjd run algorithmic-art.yaml \ +# --job-param RenderScript=$(pwd)/scripts/algorithmic-art.py \ +# --job-param OutputDirectory=$(pwd)/outputs \ +# --job-param NumAnimationFrames=50 \ +# --step RenderImages +# openjd run algorithmic-art.yaml \ +# --job-param RenderScript=$(pwd)/scripts/algorithmic-art.py \ +# --job-param OutputDirectory=$(pwd)/outputs \ +# --job-param NumAnimationFrames=50 \ +# --step EncodeVideos +# +# To see path mapping in action (see: https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run#path-mapping): +# mkdir local_outputs remote_outputs +# PATH_MAPPING_RULES="{\"version\":\"pathmapping-1.0\", \"path_mapping_rules\": [{\"source_path_format\": \"POSIX\", \"source_path\": \"$(pwd)/local_outputs\", \"destination_path\": \"$(pwd)/remote_outputs\"}]}" +# openjd run algorithmic-art.yaml \ +# --job-param RenderScript=$(pwd)/scripts/algorithmic-art.py \ +# --job-param OutputDirectory=$(pwd)/local_outputs \ +# --job-param NumAnimationFrames=50 \ +# --step RenderImages \ +# --path-mapping-rules "${PATH_MAPPING_RULES}" +# openjd run algorithmic-art.yaml \ +# --job-param RenderScript=$(pwd)/scripts/algorithmic-art.py \ +# --job-param OutputDirectory=$(pwd)/_local_outputs \ +# --job-param NumAnimationFrames=50 \ +# --step EncodeVideos \ +# --path-mapping-rules "${PATH_MAPPING_RULES}" +# Notice how the value of "OutputDirectory" is $(pwd)/local_outputs, but the files are written to +# $(pwd)/remote_outputs +# +# ---- +# Requirements (tested with ffmpeg 4.4.2) +# ---- +# - bash shell +# - python 3.9+ +# - ffmpeg +# +# ----- +# Contributors to this template: +# Daniel Neilson (https://github.com/ddneilson) + +specificationVersion: jobtemplate-2023-09 +# The name can be used by the render manager as the name of the created job, so we can +# use job parameters to differentiate submission names. +name: AlgorithmicArtSample-{{Param.NumAnimationFrames}} + +parameterDefinitions: +- name: RenderScript + type: PATH + description: > + The fully-qualified location of the 'algorithmic-art.py' script file in the filesystem. +- name: OutputDirectory + type: PATH + description: > + The fully-qualified location on the disk to put the output files generated by this job. +- name: NumAnimationFrames + type: INT + description: > + The number of animation frames to generate for each of the videos. + +steps: +- name: RenderImages + description: > + This generates animation frames for some algorithmic art. Multiple sequences of animation frames + are generated -- one for each of a set of input metaparameters to the image generation algorithm. + parameterSpace: + taskParameterDefinitions: + # The wedge parameters: StarFactor & SwirlFactor + # Both StarFactor & SwirlFactor must have the exact same number of values + # since they will be associatively combined. + # Note: If you change the values for StarFactor and/or SwirlFactor here, then you + # must also change them in the EncodeVideos step's parameter space definition. + - name: StarFactor + type: INT + range: "3-5" + - name: SwirlFactor + type: FLOAT + range: [ 5.5, 10.0, 15.0 ] + - name: Frame + type: INT + range: "0-{{Param.NumAnimationFrames}}" + # Generate all of the frames for each combination of StarFactor & SwirlFactor + # This yields the parameter space: + # {StarFactor=3,SwirlFactor=5.5,Frame=0..MaxFrame}, + # {StarFactor=4,SwirlFactor=3.0,Frame=0..MaxFrame}, + # {StarFactor=5,SwirlFactor=3.5,Frame=0..MaxFrame} + combination: "(StarFactor,SwirlFactor) * Frame" + + script: + actions: + onRun: + command: python + args: + - "{{Param.RenderScript}}" + - "{{Param.OutputDirectory}}" + - "{{Task.Param.Frame}} of {{Param.NumAnimationFrames}}" + - "{{Task.Param.StarFactor}}" + - "{{Task.Param.SwirlFactor}}" + # Step Environment' at the start of the Sesssion + stepEnvironments: + - name: PythonVenv + description: > + Creates a Python virtual environment in the Session Working directory, installs the + required Python libraries, and ensures that actions that are run while this Environment + is active will automatically be using the virtual environment. + script: + actions: + onEnter: + command: bash + args: [ "{{Env.File.Enter }}" ] + onExit: + command: bash + args: [ "{{Env.File.Exit}}" ] + embeddedFiles: + - name: Enter + type: TEXT + runnable: True + data: | + python3 -m venv .venv + source .venv/bin/activate + pip install --upgrade pip + + pip install numpy pillow + + # Export the environment variables required to have an activated virtual env. + # Open Job Description intercepts the stdout of all running processes and looks for + # lines starting in "openjd_" as an instruction to the runtime. + # These environment variables will no longer be applied once this environment is exited. + + echo "openjd_env: PATH=${PATH}" + echo "openjd_env: VIRTUAL_ENV=${VIRTUAL_ENV}" + echo "openjd_env: VIRTUAL_ENV_PROMPT=${VIRTUAL_ENV_PROMPT}" + - name: Exit + type: TEXT + runnable: True + data: | + # Delete the virtual environment. + # Not strictly required since the Session Working Directory will be deleted + # at the end of the Session, but included for demonstration. + rm -rf .venv + +- name: EncodeVideos + dependencies: + - dependsOn: RenderImages + parameterSpace: + taskParameterDefinitions: + - name: StarFactor + type: INT + range: "3-5" + - name: SwirlFactor + type: FLOAT + range: [ 5.5, 10.0, 15.0 ] + # This yields the parameter space: + # {StarFactor=3,SwirlFactor=5.5}, + # {StarFactor=4,SwirlFactor=3.0}, + # {StarFactor=5,SwirlFactor=3.5} + combination: "(StarFactor,SwirlFactor)" + + script: + actions: + onRun: + command: bash + args: [ "{{Task.File.Encode}}"] + embeddedFiles: + - name: Encode + type: TEXT + runnable: True + data: | + # Reference: https://academysoftwarefoundation.github.io/EncodingGuidelines/Quickstart.html + FILE_PREFIX="{{Param.OutputDirectory}}/algart-{{Task.Param.StarFactor}}-{{Task.Param.SwirlFactor}}" + ffmpeg -y -r 10 -start_number 1 -i ${FILE_PREFIX}-%04d.png -pix_fmt yuv420p \ + -vf "scale=in_color_matrix=bt709:out_color_matrix=bt709" \ + -frames:v 100 -c:v libx264 -preset slower \ + -color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \ + -movflags faststart ${FILE_PREFIX}.mp4 diff --git a/samples/v2023-09/job_templates/blender-ffmpeg.yaml b/samples/v2023-09/job_templates/blender-ffmpeg.yaml new file mode 100644 index 0000000..0296ae9 --- /dev/null +++ b/samples/v2023-09/job_templates/blender-ffmpeg.yaml @@ -0,0 +1,148 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# This demonstrates a Job that will render a series of animation frames +# from the Blender CLI for a given scene. It assumes you have Blender installed, accessible from +# your path and that you've downloaded the Red Autumn Forest sample here: +# https://cloud.blender.org/p/gallery/5fbd186ec57d586577c57417 and named ./scene/blender_scene.blend +# Robin Tran is the artist, https://www.artstation.com/robin_tran +# Licensed under Creative Commons: https://creativecommons.org/licenses/by-sa/3.0/ +# +# You can see a summary of what this template will do by running: +# +# openjd summary blender_render.yaml +# +# To Run with default parameters use: +# +# openjd run blender_render.yaml --step CreateVideoFromRender --run-dependencies +# +# This first renders frames from blender and then runs ffmpeg to create a video. If you want to just render frames +# use this command: +# +# openjd run blender_render.yaml --step RenderScene +# +# to override the default parameters, use this command line version: +# +# openjd run blender_render.yaml \ +# --job-param BlenderFile=./scene/your_scene_file.blend \ +# --job-param Format=JPEG \ +# --job-param EndFrame="100" \ +# --step CreateVideoFromRender --run-dependencies +# +# ---- +# Requirements (tested with Blender 4.0.2 and ffmpeg 6.1.1) +# ---- +# - bash shell +# - Blender +# - ffmpeg +# +# ----- +# Contributors to this template: +# Mark Stephens (https://github.com/zoomerkind) + +specificationVersion: 'jobtemplate-2023-09' +name: '{{Param.JobName}}' +description: | + An example of how to render a blender animation sequence to the command line and optionally create a video. +parameterDefinitions: +- name: JobName + type: STRING + userInterface: + control: LINE_EDIT + label: Job Name + default: Blender Scene Renderer +- name: EndFrame + type: INT + default: 100 +- name: BlenderFile + type: PATH + objectType: FILE + dataFlow: IN + userInterface: + control: CHOOSE_INPUT_FILE + label: Blender File + default: "./scene/blender_scene.blend" + description: Choose the Blender scene you want to render. +- name: OutputDir + type: PATH + objectType: DIRECTORY + dataFlow: OUT + userInterface: + control: CHOOSE_DIRECTORY + label: Output Directory + default: "./output" + description: Choose the render output directory. +- name: OutputPattern + type: STRING + userInterface: + control: LINE_EDIT + label: Output File Pattern + default: "render-####" + description: Enter the output filename pattern (without extension). +- name: Format + type: STRING + userInterface: + control: DROPDOWN_LIST + label: Output File Format + description: Choose the file format to render as. + default: PNG + allowedValues: [TGA, RAWTGA, JPEG, IRIS, IRIZ, PNG, HDR, TIFF, OPEN_EXR, OPEN_EXR_MULTILAYER, CINEON, DPX, DDS, JP2, WEBP] +steps: +- name: RenderScene + # Uncomment the following to render in parallel on a distributed cluster, + # and change the line '--render-frame "1..{{Param.EndFrame}}"' below + # to '--render-frame {{Task.Param.Frame}}' + # parameterSpace: + # taskParameterDefinitions: + # - name: Frame + # type: INT + # range: "1-{{Param.EndFrame}}" + script: + actions: + onRun: + command: bash + args: ['{{ Task.File.run }}'] + embeddedFiles: + - name: run + type: TEXT + data: | + #!/bin/env bash + + set -xeuo pipefail + + mkdir -p {{Param.OutputDir}} + + blender --background "{{Param.BlenderFile}}" \ + --render-output "{{Param.OutputDir}}/{{Param.OutputPattern}}" \ + --render-format "{{Param.Format}}" \ + --use-extension 1 \ + --render-frame "1..{{Param.EndFrame}}" + +- name: CreateVideoFromRender + dependencies: + - dependsOn: RenderScene + script: + actions: + onRun: + command: bash + args: [ "{{Task.File.Encode}}"] + embeddedFiles: + - name: Encode + type: TEXT + runnable: True + data: | + #!/bin/env bash + + set -xeuo pipefail + + # Reference: https://academysoftwarefoundation.github.io/EncodingGuidelines/Quickstart.html + FILE_PREFIX=`mktemp blend-video-XXXXX` + echo `pwd` + echo $FILE_PREFIX + ffmpeg -y -r 10 -start_number 1 -i {{Param.OutputDir}}/render-%04d.{{Param.Format}} -pix_fmt yuv420p \ + -vf "scale=in_color_matrix=bt709:out_color_matrix=bt709" \ + -frames:v 300 -c:v libx264 -preset fast \ + -color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \ + -movflags faststart "{{Param.OutputDir}}/../${FILE_PREFIX}.mp4" diff --git a/samples/v2023-09/job_templates/ffmpeg.yaml b/samples/v2023-09/job_templates/ffmpeg.yaml new file mode 100644 index 0000000..4a583ef --- /dev/null +++ b/samples/v2023-09/job_templates/ffmpeg.yaml @@ -0,0 +1,210 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# +# This demonstrates a Job that will take an input image sequence and output an +# initial h264 movie via FFMPEG conversion, then take that h264 movie and +# generate a webm. This should should be considered a work in progress, as I +# aim to increase the complexity and document the process. +# +# You can see a summary of what this template will do by running: +# +# openjd summary ffmpeg.yaml +# +# To Run with default parameters use: +# +# openjd run ffmpeg.yaml -p InputFile=./image_sequence.%04d.exr \ +# -p H264OutputFile=./h264Movie.mp4 -p WebMOutputFile=./WebMMovie.webm \ +# --step webm --run-dependencies +# +# If you want to just run the h264 encode, use this command: +# +# openjd run ffmpeg.yaml -p InputFile=./image_sequence.%04d.exr \ +# -p H264OutputFile=./h264Movie.mp4 -p WebMOutputFile=./WebMMovie.webm \ +# --step h264 +# +# ---- +# Requirements (tested with ffmpeg 6.1.1) +# ---- +# - bash shell +# - ffmpeg with vpx library +# +# ----- +# Contributors to this template: +# Sean Wallitsch (https://github.com/shidarin) +# +specificationVersion: 'jobtemplate-2023-09' +name: Job Bundle - FFMPEG H264/WebM Example + +parameterDefinitions: + - name: InputFile + type: PATH + objectType: FILE + dataFlow: IN + userInterface: + control: CHOOSE_INPUT_FILE + label: Input File + groupLabel: Files + fileFilters: + - label: Image Sequence Files + patterns: ["*.exr", "*.png", "*.dpx"] + - label: Any Files + patterns: ["*"] + # In a GUI, this would only "kinda" work right now, because what we + # really need to provide to FFMPEG for an image sequence is something with + # frame padding. If this were using a GUI, a GUI would tell openjd-cli + # the literal value of the file we selected, frame number and all. + # We should probably be using a script to change this value and add the + # frame padding. + description: Choose the input image sequence. + - name: H264OutputFile + description: Choose the output h264 file. + type: PATH + objectType: FILE + dataFlow: OUT + userInterface: + control: CHOOSE_OUTPUT_FILE + label: Output File + groupLabel: Files + fileFilters: + - label: MP4 + patterns: ["*.mp4"] + - label: All Files + patterns: ["*"] + - name: WebMOutputFile + description: Choose the output webm file. + type: PATH + objectType: FILE + dataFlow: OUT + userInterface: + control: CHOOSE_OUTPUT_FILE + label: Output File + groupLabel: Files + fileFilters: + - label: WebM + patterns: ["*.webm"] + - label: All Files + patterns: ["*"] + - name: FPS + type: INT + userInterface: + control: DROPDOWN_LIST + label: FPS + groupLabel: FrameInfo + description: What FPS (Frames Per Second) the movie should be encoded at. + default: 24 + allowedValues: [1, 12, 24, 30, 48, 60, 90, 96, 120, 144, 165, 240] + - name: StartFrame + type: INT + userInterface: + control: SPIN_BOX + label: Start Frame + groupLabel: FrameInfo + description: What frame to start the encode on + default: 1 + - name: StopFrame + type: INT + userInterface: + control: SPIN_BOX + label: Stop Frame + groupLabel: FrameInfo + description: What frame to end the encode on + default: 100 + +# Uncomment the following for debugging +# jobEnvironments: +# - name: debug +# # This makes it easier to tell why ffmpeg hates your command. +# # It will result in the openjd runtime echo'ing the tempfile it's writing +# description: Helps debug the commands being run +# script: +# actions: +# onEnter: +# command: "echo" +# args: +# - "openjd_session_runtime_loglevel: DEBUG" + +steps: + - name: h264 + script: + actions: + onRun: + command: "ffmpeg" + args: + # Every argument, and its value, must be a seperate list item. If + # you combine the argument and the value, FFMPEG (and most other + # CLI tools) will treat them as one combined arg and have no idea + # how to handle this. This is a side result of how openjd is + # formatting those args, as each item on this list will be + # enclosed in single quotes after being its values being + # formatted. + - "-r" + - "{{Param.FPS}}" + - "-start_number" + - "{{Param.StartFrame}}" + - "-i" + - "{{Param.InputFile}}" + - "-pix_fmt" + - "yuv422p" + - "-vf" + - "scale=in_color_matrix=bt709:out_color_matrix=bt709" + - "-frames:v" + - "{{Param.StopFrame}}" + - "-c:v" + - "libx264" + - "-preset" + - "slower" + - "-color_range" + - "tv" + - "-colorspace" + - "bt709" + - "-color_primaries" + - "bt709" + - "-color_trc" + - "iec61966-2-1" + - "-movflags" + - "faststart" + - "{{Param.H264OutputFile}}" + - name: webm + dependencies: + - dependsOn: 'h264' + script: + actions: + onRun: + command: "ffmpeg" + args: + - "-r" + - "{{Param.FPS}}" + - "-i" + - "{{Param.H264OutputFile}}" + - "-c:v" + - "libvpx-vp9" + - "-pix_fmt" + - "yuv420p10le" + - "-crf" + - "22" + - "-speed" + - "2" + - "-row-mt" + - "1" + - "-quality" + - "good" + - "-b:v" + - "0" + - "-sws_flags" + - "spline+accurate_rnd+full_chroma_int" + - "-vf" + - "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" + - "-color_range" + - "tv" + - "-colorspace" + - "bt709" + - "-color_primaries" + - "bt709" + - "-color_trc" + - "iec61966-2-1" + - "-y" + - "{{Param.WebMOutputFile}}" + diff --git a/samples/v2023-09/job_templates/host-requirements.yaml b/samples/v2023-09/job_templates/host-requirements.yaml new file mode 100644 index 0000000..a9ed965 --- /dev/null +++ b/samples/v2023-09/job_templates/host-requirements.yaml @@ -0,0 +1,75 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# The use of host requirements in a Step to restrict which host(s) the Step +# can be run on. +# +# See: https://github.com/OpenJobDescription/openjd-specifications/wiki/2023-09%3A-Template-Schemas#33-hostrequirements +# +# ---- +# Requirements +# ---- +# - python +# +# ----- +# Contributors to this template: +# Daniel Neilson (https://github.com/ddneilson) + +specificationVersion: jobtemplate-2023-09 +name: DemoHostRequirements + +steps: +- name: StepOne + script: + actions: + onRun: + command: python + args: [ "-c", "print('This is StepOne - it is light on resources')" ] + hostRequirements: + amounts: + - name: amount.worker.vcpu + min: 1 + max: 1 + - name: amount.worker.memory + min: 256 + max: 1024 + attributes: + - name: attr.worker.os.family + anyOf: + - linux + - macos + # A studio-specific attribute that is defined in your render management + # system. The idea being to abstract away the specific details of how + # a host has been configured (e.g. linux distribution installed; specific + # software & versions installed; etc). + - name: attr.custom.host_config + anyOf: + - "HostConfigA" + - "HostConfigC" + +- name: StepTwo + script: + actions: + onRun: + command: python + args: [ "-c", "print('This is StepTwo - pretend it is heavier on resources')" ] + hostRequirements: + amounts: + - name: amount.worker.vcpu + min: 4 + max: 16 + - name: amount.worker.memory + min: 8192 + attributes: + - name: attr.worker.os.family + anyOf: + - linux + # A studio-specific attribute that is defined in your render management + # system. The idea being to abstract away the specific details of how + # a host has been configured (e.g. linux distribution installed; specific + # software & versions installed; etc). + - name: attr.custom.host_config + anyOf: + - "HostConfigB" \ No newline at end of file diff --git a/samples/v2023-09/job_templates/scripts/algorithmic-art.py b/samples/v2023-09/job_templates/scripts/algorithmic-art.py new file mode 100644 index 0000000..0458445 --- /dev/null +++ b/samples/v2023-09/job_templates/scripts/algorithmic-art.py @@ -0,0 +1,84 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# + +import numpy as np +from PIL import Image +from pathlib import Path +import sys +import re + +def polar_2d(dimensions: tuple[int,int]) -> tuple[np.ndarray, np.ndarray]: + # 2d arrays of polar coordinates (r,theta) with the center of the polar plane + # at the dimensional center of the returned grid. + # Input: dimensions -- (width,height) + # Returns: (radius, theta) + # Each y[i] is an array w/ values 0..dimensions[0] + # Each x[i] is an array of length x filled with i's + x,y = np.meshgrid(*map(range, dimensions)) + center = np.array(dimensions)/2 + x,y = x-center[0], y-center[1] + radius = np.sqrt(x**2 + y**2) + theta = np.arctan2(y,x) + return radius, theta + +def false_color_map() -> np.ndarray: + # Generate a falsecolor map + # Return: uint8[256][3] + colors = np.array([[0,255,0],[255,255,0],[255,0,0],[255,0,255],[0,0,255],[0,255,255],[0,255,0]]) + positions = [0,30,90,120,190,230,255] + assert len(positions) == len(colors) + colormap = np.zeros((256,3), dtype=np.uint8) + for idx in range(0, len(colors)-1): + c1,c2,p1,p2 = colors[idx],colors[idx+1],positions[idx],positions[idx+1] + # Linear interpolation between the colors + for i in range(p1,p2+1): + x = (i-p1)/(p2-p1) + colormap[i,:] = c1*(1-x)+c2*x + return colormap + +def apply_color_map(image: np.ndarray, colors: np.ndarray) -> np.ndarray: + flattened = np.uint8(image.reshape(-1)) + return colors[flattened].reshape(image.shape+(3,)) + +def generate_image(dimensions: tuple[int,int], jaggy: float, star: int, swirl: float) -> Image: + # Note: Fractional 'star' leads to discontinuities in the image. + radius,theta = polar_2d(dimensions) + log_radius = np.log(1+radius) + np_image = np.sin(theta*star + np.sin(log_radius*jaggy) + log_radius*swirl) + # Vary the color with distance from the center + np_image += log_radius + # Clamp to [0,1] and apply the false coloring + clamped_image = np.fmod(np_image, 1) + color_map = false_color_map() + raw_data = apply_color_map(255*clamped_image, color_map) + return Image.fromarray(raw_data) + +def usage(): + print(f"Usage: {sys.argv[0]} ' of ' ") + +if __name__ == "__main__": + if len(sys.argv) < 3: + usage() + sys.exit(1) + if not (frame_info := re.match("(.+) of (.+)", sys.argv[2])): + print("Error - Frame argument malformed") + usage() + sys.exit(1) + try: + frame = int(frame_info[1]) + max_frame = int(frame_info[2]) + star_factor = int(sys.argv[3]) + swirl_factor = float(sys.argv[4]) + except: + print("Error parsing arguments") + usage() + sys.exit(1) + + frame_ratio = frame/max_frame + # Linearly interpolate + jaggy = 1*(1-frame_ratio) + 5*frame_ratio + + image = generate_image((640,480), jaggy, star_factor, swirl_factor) + outfile_name = str(Path(sys.argv[1]) / f"algart-{star_factor}-{swirl_factor}-{str(frame).zfill(4)}.png") + print("Writing image: ", outfile_name) + image.save(outfile_name) diff --git a/samples/v2023-09/job_templates/stdout-messages.yaml b/samples/v2023-09/job_templates/stdout-messages.yaml new file mode 100644 index 0000000..a36d458 --- /dev/null +++ b/samples/v2023-09/job_templates/stdout-messages.yaml @@ -0,0 +1,55 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# This demonstrates Open Job Description's "stdout messages." These are special messages +# that can be emitted on stdout or stderr as a single line by an Action when it is running +# within a Session. The application that is running the Action may intercept these messages +# to convey information about the Action to the render management system. +# +# Reference: https://github.com/OpenJobDescription/openjd-specifications/wiki/How-Jobs-Are-Run#stdoutstderr-messages +# +# ---- +# Requirements +# ---- +# - python +# +# ----- +# Contributors to this template: +# Daniel Neilson (https://github.com/ddneilson) + +specificationVersion: jobtemplate-2023-09 +name: ShowOffStdoutMessages + +steps: +- name: Demo + script: + actions: + onRun: + command: python + args: [ "{{Task.File.Run}}"] + embeddedFiles: + - name: Run + type: TEXT + runnable: True + data: | + #!/usr/bin/env python + + # Inform the system about our progress to be passed-on to the user. + print("openjd_progress: 0.0") + + # Inform the system what we're doing so that it can be communicated to the user. + print("openjd_status: Loading the things") + + print("openjd_progress: 50.0") + + print("openjd_status: Processing the things") + + if 1+1 != 2: + # If the process fails then we can tell the system *why* we failed so that + # it can be presented to the user without forcing them to dig through logs. + print("openjd_fail: The rules of mathematics have been violated!") + raise RuntimeError("The rules of mathematics have been violated!") + + print("openjd_progress: 100") diff --git a/samples/v2023-09/job_templates/ui-controls-showcase.yaml b/samples/v2023-09/job_templates/ui-controls-showcase.yaml new file mode 100644 index 0000000..84980eb --- /dev/null +++ b/samples/v2023-09/job_templates/ui-controls-showcase.yaml @@ -0,0 +1,236 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# ---- +# Demonstrates +# ---- +# A showcase of all of the different kinds of UI metadata that can be associated +# with the definition of a Job Parameter in a job template. +# +# ---- +# Requirements +# ---- +# - bash shell +# +# ----- +# Contributors to this template: +# Mark Wiebe (https://github.com/mwiebe) + +specificationVersion: 'jobtemplate-2023-09' +name: Job Template GUI Control Showcase +parameterDefinitions: + - name: LineEditControl + type: STRING + userInterface: + control: LINE_EDIT + label: Line Edit Control + groupLabel: Text Controls + description: "Unrestricted line of text!" + default: Default line edit value. + - name: MultiLineEditControl + type: STRING + userInterface: + control: MULTILINE_EDIT + label: Multi-line Edit Control + groupLabel: Text Controls + description: "Unrestricted text file" + default: | + This is a + text file with + multiple lines. + - name: IntSpinner + type: INT + userInterface: + control: SPIN_BOX + label: Default Int Spinner + groupLabel: Int Spinners + description: A default integer spinner. + default: 42 + - name: BigStepIntSpinner + type: INT + userInterface: + control: SPIN_BOX + label: Big Step Int Spinner + groupLabel: Int Spinners + singleStepDelta: 30 + description: A default integer spinner. + default: 123 + - name: BoundedIntSpinner + type: INT + userInterface: + control: SPIN_BOX + label: Bounded Int Spinner + groupLabel: Int Spinners + description: A bounded integer spin box. + minValue: -100 + maxValue: 100 + default: 25 + - name: FloatSpinner + type: FLOAT + userInterface: + control: SPIN_BOX + label: Default Float Spinner + groupLabel: Float Spinners + description: A default float spinner. + default: 1234.56789 + - name: FloatSpinnerOneDecimal + type: FLOAT + userInterface: + control: SPIN_BOX + label: Float Spinner One Decimal + groupLabel: Float Spinners + decimals: 1 + description: A float spinner with one decimal of precision. + default: 100000.01 + - name: FloatSpinnerFixedStep + type: FLOAT + userInterface: + control: SPIN_BOX + label: Float Spinner Fixed Step + groupLabel: Float Spinners + singleStepDelta: 0.875 + default: 0.0 + description: A float spinner with a fixed step of .875 + - name: StringDropdown + type: STRING + userInterface: + control: DROPDOWN_LIST + label: String Dropdown + groupLabel: Dropdown Controls + description: A dropdown with string values. + default: WEDNESDAY + allowedValues: [MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY] + - name: IntDropdown + type: INT + userInterface: + control: DROPDOWN_LIST + label: Int Dropdown + groupLabel: Dropdown Controls + description: A dropdown with integer values. + default: 7 + allowedValues: [3, 8, 7, 2, 9, 1] + - name: HiddenFieldOne + type: INT + userInterface: + control: HIDDEN + description: A hidden field that won't show on the UI + default: 10 + - name: FloatDropdown + type: FLOAT + userInterface: + control: DROPDOWN_LIST + label: Float Dropdown + groupLabel: Dropdown Controls + description: A dropdown with floating point values. + default: 3.26 + allowedValues: [1.23, 3.26, 9.9, 1.2345] + - name: InputFilePicker + type: PATH + objectType: FILE + dataFlow: IN + userInterface: + control: CHOOSE_INPUT_FILE + label: Input File Picker + groupLabel: Picker Controls + fileFilters: + - label: Scene Files + patterns: ["*.blend", "*.mb", "*.ma", "*.nk"] + - label: Any Files + patterns: ["*"] + description: Choose the input scene file. + - name: OutputFilePicker + type: PATH + objectType: FILE + dataFlow: OUT + userInterface: + control: CHOOSE_OUTPUT_FILE + label: Output File Picker + groupLabel: Picker Controls + fileFilters: + - label: EXR Files + patterns: ["*.exr"] + - label: JPEG Files + patterns: ["*.jpg", "*.jpeg"] + - label: PNG Files + patterns: ["*.png"] + - label: All Files + patterns: ["*"] + description: Choose the output image file. + - name: DirectoryPicker + type: PATH + objectType: DIRECTORY + dataFlow: INOUT + userInterface: + control: CHOOSE_DIRECTORY + label: Directory Picker + groupLabel: Picker Controls + description: Choose a directory. + - name: CheckBox + type: STRING + userInterface: + control: CHECK_BOX + label: Check Box "Boolean" + default: "True" + allowedValues: ["True", "False"] + description: Set a true/false value. + - name: HiddenFieldTwo + type: STRING + userInterface: + control: HIDDEN + label: This won't show + description: A hidden field that won't show on the UI + default: This is a hidden string parameter +steps: +- name: CliScript + script: + actions: + onRun: + command: bash + args: ['{{Task.File.runScript}}'] + embeddedFiles: + - name: runScript + type: TEXT + data: | + #!/usr/bin/env bash + + echo 'LineEditControl value:' + echo '{{Param.LineEditControl}}' + + echo 'MultiLineEditControl value:' + echo '{{Param.MultiLineEditControl}}' + + echo 'IntSpinner value:' + echo '{{Param.IntSpinner}}' + + echo 'BigStepIntSpinner value:' + echo '{{Param.BigStepIntSpinner}}' + + echo 'FloatSpinner value:' + echo '{{Param.FloatSpinner}}' + + echo 'FloatSpinnerOne value:' + echo '{{Param.FloatSpinnerOneDecimal}}' + + echo 'StringDropdown value:' + echo '{{Param.StringDropdown}}' + + echo 'IntDropdown value:' + echo '{{Param.IntDropdown}}' + + echo 'FloatDropdown value:' + echo '{{Param.FloatDropdown}}' + + echo 'InputFilePicker raw value:' + echo '{{RawParam.InputFilePicker}}' + echo 'InputFilePicker value mapped locally:' + echo '{{Param.InputFilePicker}}' + + echo 'OutputFilePicker raw value:' + echo '{{RawParam.OutputFilePicker}}' + echo 'OutputFilePicker value mapped locally:' + echo '{{Param.OutputFilePicker}}' + + echo 'DirectoryPicker raw value:' + echo '{{RawParam.DirectoryPicker}}' + echo 'DirectoryPicker value mapped locally:' + echo '{{Param.DirectoryPicker}}' + diff --git a/wiki/2023-09:-Template-Schemas.md b/wiki/2023-09:-Template-Schemas.md index f4fa3ca..080be3c 100644 --- a/wiki/2023-09:-Template-Schemas.md +++ b/wiki/2023-09:-Template-Schemas.md @@ -1111,7 +1111,7 @@ written prior to every one of the corresponding actions each time that they are are read-only by only the user under which the task will be run on the worker host. ```bnf - ::= + ::= ``` ### 6.1. `` diff --git a/wiki/Home.md b/wiki/Home.md index 7285860..8767ad5 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -24,7 +24,9 @@ by Pauline Koh, Senior Product Manager at Amazon Web Services, titled *Portable ## Getting Started The fastest way to understand the bones of Open Job Description is to understand both [How Jobs Are Constructed](How-Jobs-Are-Constructed) -and [How Jobs Are Run](How-Jobs-Are-Run). +and [How Jobs Are Run](How-Jobs-Are-Run). You may also find it beneficial to look through the provided +[sample templates](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/samples) in this GitHub +repository. ## Contributing @@ -41,3 +43,21 @@ We want your input! Please see our [Contributing Guidelines](https://github.com/ * [Pull Requests](https://github.com/OpenJobDescription/openjd-specifications/pulls): We welcome pull requests to improve this wiki documentation. Simply make your changes in our [GitHub Repository](https://github.com/OpenJobDescription/openjd-specifications/tree/mainline/wiki) and post a pull request. + +## Open Job Description Projects + +*If you have an Open Job Description project that you would like to advertise here then please +submit a pull request.* + +### Tools + +* [openjd-cli](https://github.com/OpenJobDescription/openjd-cli) - Provides a command-line + interface for working with Open Job Description templates. + +### Libraries + +* [openjd-model](https://github.com/OpenJobDescription/openjd-model-for-python) - A Python + implementation of the data model for Open Job Description's template schemas. +* [openjd-sessions](https://github.com/OpenJobDescription/openjd-sessions-for-python) - A Python + library that can be used to build a runtime that is able to run Jobs in a Session as defined + by Open Job Description.