Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wiki): add an introduction to creating jobs #45

Merged

Conversation

ddneilson
Copy link
Contributor

This adds a guide to the wiki that walks the reader through developing a Job with Open Job Description. The guide explains elements of the Job Template as it introduces concepts bit by bit, and shows how to use the CLI to verify and test their Jobs on their workstation.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This adds a guide to the wiki that walks the reader through developing a Job with
Open Job Description. The guide explains elements of the Job Template as it introduces
concepts bit by bit, and shows how to use the CLI to verify and test their Jobs on
their workstation.

Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson requested a review from a team as a code owner July 8, 2024 21:41

We'll go through both options.

##### 2.2.4.2.1. With a Combination Expression
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section needs the feature request OpenJobDescription/openjd-model-for-python#131 to be implemented before it can be published.

Copy link
Contributor

@shidarin shidarin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits, couple rewords, some details missing.

wiki/Home.md Outdated Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Show resolved Hide resolved
...
```

Then modify it so that it accepts script arguments:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script arguments or CLI arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

command-line args. Clarified in doc

wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
Comment on lines 290 to 295
The way to think about a Step in Open Job Description is that it is defining a command to run and the collection of inputs
to run the command with. This is a [map operation](https://en.wikipedia.org/wiki/Map_(higher-order_function)), if
you are familiar with that concept. You're not going to define any inputs for the command yet, so you'll be using the default
of having a single Task with empty input. The command is defined in the `onRun` Action in the skeleton above; this is
the command that is run when running a Task within a [Session](How-Jobs-Are-Run#sessions). An Action in the 2023-09
revision of the specification [is defined as](2023-09-Template-Schemas#5-action):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We suddenly up the reading and tech level a lot with this paragraph and the few that follow. Consider shorter sentences and more of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've adjusted this significantly. Let me know what you think.

they are [Format Strings](How-Jobs-Are-Constructed#format-strings) that are evaluated on the host that the command will
run on. We're going to make use of this property to create our Job.

You've already expressed your Job as a series of two shell scripts to run in sequence, so next you'll make use of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we skipped a step- we haven't had the OpenJD example of using the script itself yet, so "you've already expressed your job as.." doesn't make much sense. We've only been running single scripts, not any Jobs yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back with fresh eyes, I would phrase it as "We've created two scripts and can manually run them in sequence to approximate the results we want. We can use Open Job Description's concept of embedded files to put those scripts directly into a Job template, which..

# Note: Task.File.Render refers to the file location on disk where the
# contents of the embedded file named "Render" are materialized.
command: "{{Task.File.Render}}"
args:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be good to comment here that this needs to be a list as it's one area we've been people butt their heads against (including me)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added something.

...
```

### 2.3. Ready for Production
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: We should add something on the hostRequirements property in here.

shidarin
shidarin previously approved these changes Jul 10, 2024
they are [Format Strings](How-Jobs-Are-Constructed#format-strings) that are evaluated on the host that the command will
run on. We're going to make use of this property to create our Job.

You've already expressed your Job as a series of two shell scripts to run in sequence, so next you'll make use of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back with fresh eyes, I would phrase it as "We've created two scripts and can manually run them in sequence to approximate the results we want. We can use Open Job Description's concept of embedded files to put those scripts directly into a Job template, which..

# Return an error code if any command in the script fails.
set -eou pipefail

TMPFILE=$(mktemp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the comments from the above

wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
...
```

Uh-oh, there's an error! Blender couldn't find the input file. This is because all actions in a Session are always run with their
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "The error means that Blender couldn't find the input file."

wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
...
```

Also remove the definitions of the `FrameStart` and `FrameEnd` Job Parameters from the template because they are no longer used,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the rest of this example to be fully demonstrated. We can list the caveats and gotchas and move on.

--render-frame "${FRAME}"
```

or you need to modify the template so that it has both a testing and production mode. We'll do the later in this guide to demonstrate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should break out this guide is long enough to break out into multiple pages. If we do that, feel free to ignore some of my earlier comments are removals.

wiki/Introduction-to-Creating-a-Job.md Outdated Show resolved Hide resolved
wiki/Introduction-to-Creating-a-Job.md Show resolved Hide resolved
Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>

Co-authored-by: Sean Wallitsch <5846610+shidarin@users.noreply.github.com>
Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson requested a review from shidarin July 15, 2024 18:42
Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson force-pushed the authoring_job_template branch from 2570953 to fdc1198 Compare July 15, 2024 22:47
Signed-off-by: Daniel Neilson <53624638+ddneilson@users.noreply.github.com>
@ddneilson ddneilson enabled auto-merge (squash) July 16, 2024 00:07
@ddneilson ddneilson merged commit f2d566f into OpenJobDescription:mainline Jul 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants