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

Update Jinja2 and EmPy templating sections. #631

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

hjoliver
Copy link
Member

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.

@hjoliver hjoliver added this to the 8.2.x milestone Jul 25, 2023
@hjoliver hjoliver self-assigned this Jul 25, 2023
@hjoliver hjoliver requested review from wxtim and MetRonnie July 26, 2023 06:38
@hjoliver
Copy link
Member Author

(Assigned reviewers of the cylc-flow sibling PR).

Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

  • Built it and read the built version.
  • Read the source.

I've left a couple of comments. Neither should block merge.

src/user-guide/writing-workflows/jinja2.rst Show resolved Hide resolved
src/user-guide/writing-workflows/jinja2.rst Show resolved Hide resolved
@MetRonnie MetRonnie modified the milestones: 8.2.x, 8.2.0 Aug 14, 2023
@oliver-sanders oliver-sanders modified the milestones: 8.2.0, 8.3.0 Aug 15, 2023
@hjoliver
Copy link
Member Author

hjoliver commented Sep 12, 2023

Test case, to confirm the docs:

#!Jinja2
[scheduling]
   [[graph]]
      R1 = "foo"
[runtime]
   [[foo]]
      script = """
# ALL:
echo   CYLC_VERSION {{CYLC_VERSION}}
echo   CYLC_WORKFLOW_NAME {{CYLC_WORKFLOW_NAME}}
echo   CYLC_TEMPLATE_VARS {{CYLC_TEMPLATE_VARS}}

# ONLY if installed:
echo   CYLC_WORKFLOW_ID {{CYLC_WORKFLOW_ID | default("xxxxxxxxxxxx")}}
echo   CYLC_WORKFLOW_RUN_DIR {{CYLC_WORKFLOW_RUN_DIR   | default("xxxxxxxxxxxx")}}

# ONLY if running:
echo   CYLC_WORKFLOW_LOG_DIR {{CYLC_WORKFLOW_LOG_DIR   | default("xxxxxxxxxxxx")}}
echo   CYLC_WORKFLOW_SHARE_DIR {{CYLC_WORKFLOW_SHARE_DIR | default("xxxxxxxxxxxx")}}
echo   CYLC_WORKFLOW_WORK_DIR {{CYLC_WORKFLOW_WORK_DIR  | default("xxxxxxxxxxxx")}}
      """

Result:

cylc-src/bug $ cylc config -i '[runtime][foo]script' .  # src
# ALL:
echo   CYLC_VERSION 8.3.0.dev
echo   CYLC_WORKFLOW_NAME bug
echo   CYLC_TEMPLATE_VARS {'CYLC_VERSION': '8.3.0.dev', 'CYLC_TEMPLATE_VARS': {...}}
# ONLY if installed:
echo   CYLC_WORKFLOW_ID xxxxxxxxxxxx
echo   CYLC_WORKFLOW_RUN_DIR xxxxxxxxxxxx
# ONLY if running:
echo   CYLC_WORKFLOW_LOG_DIR xxxxxxxxxxxx
echo   CYLC_WORKFLOW_SHARE_DIR xxxxxxxxxxxx
echo   CYLC_WORKFLOW_WORK_DIR xxxxxxxxxxxx

cylc-src/bug $ cylc config -i '[runtime][foo]script' bug  # installed
# ALL:
echo   CYLC_VERSION 8.3.0.dev
echo   CYLC_WORKFLOW_NAME bug
echo   CYLC_TEMPLATE_VARS {'CYLC_VERSION': '8.3.0.dev', 'CYLC_TEMPLATE_VARS': {...}}
# ONLY if installed:
echo   CYLC_WORKFLOW_ID bug/run19
echo   CYLC_WORKFLOW_RUN_DIR /home/oliverh/cylc-run/bug/run19
# ONLY if running:
echo   CYLC_WORKFLOW_LOG_DIR xxxxxxxxxxxx
echo   CYLC_WORKFLOW_SHARE_DIR xxxxxxxxxxxx
echo   CYLC_WORKFLOW_WORK_DIR xxxxxxxxxxxx

@hjoliver
Copy link
Member Author

Merged your two suggestions @MetRonnie

Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

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

Test failure seems unrelated

@MetRonnie MetRonnie merged commit 8e4ed00 into cylc:master Sep 13, 2023
1 check failed
wxtim pushed a commit to wxtim/cylc-doc that referenced this pull request Sep 27, 2023
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.

Document Jinja2 access to workflow dir (source or installed)
4 participants