Package: openjd-sessions
Open Job Description - Sessions for PythonOpen Job Description is a flexible open specification for defining render jobs which are portable
between studios and render solutions. This package provides a library that can be used to build
a runtime that is able to run Jobs in aSessionas defined by Open Job Description.For more information about Open Job Description and our goals with it, please see the
Open Job DescriptionWiki on GitHub.CompatibilityThis library requires:Python 3.9 or higher;Linux, MacOS, or Windows operating system;On Linux/MacOS:sudoOn Windows:PowerShell 5.xEXPERIMENTALNote that compatibility with the Windows operating system is currently in active development
and should be considered to be experimental. We recommend that this library not be used in Windows-based
production environments at this time. We will remove this notice when Windows compatibility is considered
sufficiently stable and secure for use in Windows-based production environments.VersioningThis package's version followsSemantic Versioning 2.0, but is still considered to be in its
initial development, thus backwards incompatible versions are denoted by minor version bumps. To help illustrate how
versions will increment during this initial development stage, they are described below:The MAJOR version is currently 0, indicating initial development.The MINOR version is currently incremented when backwards incompatible changes are introduced to the public API.The PATCH version is currently incremented when bug fixes or backwards compatible changes are introduced to the public API.ContributingWe encourage all contributions to this package.  Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.Please seeCONTRIBUTING.mdfor our contributing guidelines.Example UsageRunning a Sessionfromopenjd.modelimport(StepParameterSpaceIterator,create_job,decode_job_template,preprocess_job_parameters)fromopenjd.sessionsimport(LOG,ActionState,ActionStatus,Session)importloggingimportosfrompathlibimportPathimportsysfromthreadingimportEvent#   Setup# ========job_template_path=Path("/absolute/path/to/job")job_template=decode_job_template(template={"name":"DemoJob","specificationVersion":"jobtemplate-2023-09","parameterDefinitions":[{"name":"Foo","type":"INT"}],"jobEnvironments":[{"name":"DemoJobEnv","script":{"actions":{"onEnter":{"command":"python","args":["-c","print('Entering DemoJobEnv')"]},"onExit":{"command":"python","args":["-c","print('Exiting DemoJobEnv')"]}}}}],"steps":[{"name":"DemoStep","stepEnvironments":[{"name":"DemoStepEnv","script":{"actions":{"onEnter":{"command":"python","args":["-c","print('Entering DemoStepEnv')"]},"onExit":{"command":"python","args":["-c","print('Exiting DemoStepEnv')"]}}}}],"parameterSpace":{"taskParameterDefinitions":[{"name":"Bar","type":"INT","range":"1-10"}]},"script":{"actions":{"onRun":{"command":"python","args":["-c","print(r'Foo={{Param.Foo}} Bar={{Task.Param.Bar}}')"]}}}}]})job_parameters=preprocess_job_parameters(job_template=job_template,job_parameter_values={"Foo":"12"},job_template_dir=job_template_path,current_working_dir=Path(os.getcwd()))job=create_job(job_template=job_template,job_parameter_values=job_parameters)# stdout/stderr from the Session's running processes are sent to LOGLOG.addHandler(logging.StreamHandler(stream=sys.stdout))#   Run the Session# ======action_event=Event()last_status:ActionStatus=Nonedefaction_complete_callback(session_id:str,status:ActionStatus)->None:# This function will be called by the Session when one of the processes# that was started has experienced a status change.# e.g. Completing as FAILED/SUCCEEDED, or an update to a progress message.globallast_statuslast_status=statusifstatus.state!=ActionState.RUNNING:action_event.set()# Run all tasks in the DemoStep within a SessionwithSession(session_id="demo",job_parameter_values=job_parameters,callback=action_complete_callback)assession:unwind_session:bool=Falseenvironment_ids=list[str]()step=job.steps[0]try:defrun_environment(env):globalstatusaction_event.clear()id=session.enter_environment(environment=env)environment_ids.append(id)# enter_environment is non-blocking, wait for the process to completeaction_event.wait()iflast_status.statein(ActionState.CANCELED,ActionState.FAILED):raiseRuntimeError("Abnormal exit")# Enter each job environmentforenvinjob.jobEnvironments:run_environment(env)# Enter each step environmentforenvinstep.stepEnvironments:run_environment(env)# Run each task in the stepfortask_parametersinStepParameterSpaceIterator(space=step.parameterSpace):action_event.clear()session.run_task(step_script=step.script,task_parameter_values=task_parameters)# run_task is non-blocking, wait for the process to completeaction_event.wait()iflast_status.statein(ActionState.CANCELED,ActionState.FAILED):raiseRuntimeError("Abnormal exit")exceptRuntimeError:passfinally:# Exit all environments in the reverse order that they were entered.environment_ids.reverse()for_idinenvironment_ids:session.exit_environment(identifier=_id)action_event.clear()action_event.wait()DownloadingYou can download this package from:PyPIGitHub releasesVerifying GitHub ReleasesYou can verify the authenticity of the release artifacts using thegpgcommand line tool.Download the desired release artifacts from the GitHub releases page. Make sure to download the corresponding PGP signature file (ending with.sig) as well.
For example, if you would like to verify your download of the wheel for version1.2.3, you should have the following files downloaded:openjd_sessions-1.2.3-py3-none-any.whl
openjd_sessions-1.2.3-py3-none-any.whl.sigInstall thegpgcommand line tool. The installation process varies by operating system. Please refer to the GnuPG website for instructions:https://gnupg.org/download/Save the following contents to a file calledopenjobdescription-pgp.asc:-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGXGjx0BEACdChrQ/nch2aYGJ4fxHNQwlPE42jeHECqTdlc1V/mug+7qN7Pc
C4NQk4t68Y72WX/NG49gRfpAxPlSeNt18c3vJ9/sWTukmonWYGK0jQGnDWjuVgFT
XtvJAAQBFilQXN8h779Th2lEuD4bQX+mGB7l60Xvh7vIehE3C4Srbp6KJXskPLPo
dz/dx7a+GXRiyYCYbGX4JziXSjQZRc0tIaxLn/GDm7VnXpdHcUk3qJitree61oC8
agtRHCH5s56E8wt8fXzyStElMkFIZsoLDlLp5lFqT81En9ho/+K6RLBkIj0mC8G7
BafpHKlxkrIgNK3pWACL93GE6xihqwkZMCAeqloVvkOTdfAKDHuDSEHwKxHG3cZ1
/e1YhtkPMVF+NMeoQavykUGVUT1bRoVNdk6bYsnbUjUI1A+JNf6MqvdRJyckZqEC
ylkBekBp/SFpFHvQkRCpfVizm2GSrjdZKgXpm1ZlQJyMRVzc/XPbqdSWhz52r3IC
eudwReHDc+6J5rs6tg3NbFfPVfCBMSqHlu1HRewWAllIp1+y6nfL4U3iEsUvZ1Y6
IV3defHIP3kNPU14ZWf3G5rvJDZrIRnjoWhDcaVmivmB/cSdDzphL5FovSI8dsPm
iU/JZGQb3EvZq+nl4pOiK32hETJ/fgCCzgUA3WqGeFNUNSI9KYZgBe6daQARAQAB
tDRPcGVuIEpvYiBEZXNjcmlwdGlvbiA8b3BlbmpvYmRlc2NyaXB0aW9uQGFtYXpv
bi5jb20+iQJXBBMBCABBFiEEvBcWYrv5OB7Tl2sZovDwWbzECYcFAmXGjx0DGy8E
BQkDwmcABQsJCAcCAiICBhUKCQgLAgMWAgECHgcCF4AACgkQovDwWbzECYcSHRAA
itPYx48xnJiT6tfnult9ZGivhcXhrMlvirVYOqEtRrt0l18sjr84K8mV71eqFwMx
GS7e4iQP6guqW9biQfMA5/Id8ZjE7jNbF0LUGsY6Ktj+yOlAbTR+x5qr7Svb7oEs
TMB/l9HBZ1WtIRzcUk9XYqzvYQr5TT997A63F28u32RchJ+5ECAz4g/p91aWxwVo
HIfN10sGzttoukJCzC10CZAVscJB+nnoUbB/o3bPak6GUxBHpMgomb0K5g4Z4fXY
4AZ9jKFoLgNcExdwteiUdSEnRorZ5Ny8sP84lwJziD3wuamVUsZ1C/KiQJBGTp5e
LUY38J1oIwptw5fqjaAq2GQxEaIknWQ4fr3ZvNYUuGUt5FbHe5U5XF34gC8PK7v7
bT/7sVdZZzKFScDLfH5N36M5FrXfTaXsVbfrRoa2j7U0kndyVEZyJsKVAQ8vgwbJ
w/w2hKkyQLAg3l5yO5CHLGatsfSIzea4WoOAaroxiNtL9gzVXzqpw6qPEsH9hsws
HsPEQWXHmDQvFTNUU14qic1Vc5fyxCBXIAGAPBd20b+219XznJ5uBKUgtvnqcItj
nMYe6Btxh+pjrTA15X/p81z6sB7dkL1hPHfawLhCEzJbIPyyBTQYqY00/ap4Rj7t
kzSiyzBejniFfAZ6eYBWsej7uXUsVndBF1ggZynPTeE=
=iaEm
-----END PGP PUBLIC KEY BLOCK-----Import the OpenPGP key for Open Job Description by running the following command:gpg --import --armor openjobdescription-pgp.ascDetermine whether to trust the OpenPGP key. Some factors to consider when deciding whether or not to trust the above key are:The internet connection you’ve used to obtain the GPG key from this website is secureThe device that you are accessing this website on is secureIf you have decided to trust the OpenPGP key, then edit the key to trust withgpglike the following example:$ gpg --edit-key A2F0F059BCC40987
gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


pub  4096R/BCC40987  created: 2024-02-09  expires: 2026-02-08  usage: SCEA
                     trust: unknown       validity: unknown
[ unknown] (1). Open Job Description <openjobdescription@amazon.com>

gpg> trust
pub  4096R/BCC40987  created: 2024-02-09  expires: 2026-02-08  usage: SCEA
                     trust: unknown       validity: unknown
[ unknown] (1). Open Job Description <openjobdescription@amazon.com>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub  4096R/BCC40987  created: 2024-02-09  expires: 2026-02-08  usage: SCEA
                     trust: ultimate      validity: unknown
[ unknown] (1). Open Job Description <openjobdescription@amazon.com>
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> quitVerify the signature of the Open Job Description release viagpg --verify. The command for verifying the example files from step 1 would be:gpg --verify ./openjd_sessions-1.2.3-py3-none-any.whl.sig ./openjd_sessions-1.2.3-py3-none-any.whlSecuritySeeCONTRIBUTINGfor more information.LicenseThis project is licensed under the Apache-2.0 License.