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

example: cycle on irregular intervals #6349

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Sep 2, 2024

Closes #6336
Requires cylc/cylc-doc#759

Not perfect, but it saves us duping this support.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders oliver-sanders added the doc Documentation label Sep 2, 2024
@oliver-sanders oliver-sanders added this to the 8.4.0 milestone Sep 2, 2024
@oliver-sanders oliver-sanders self-assigned this Sep 2, 2024
@oliver-sanders
Copy link
Member Author

oliver-sanders commented Sep 3, 2024

(Code blocks currently render as errors due to a shortcoming in the Cylc lexer)

@oliver-sanders
Copy link
Member Author

oliver-sanders commented Sep 17, 2024

(Code blocks currently render as errors due to a shortcoming in the Cylc lexer)

cylc/cylc-sphinx-extensions#86 will fix the issue. That PR needs to be merged & released before this one is (as it will cause cylc-doc build errors otherwise).

Now sorted.

@oliver-sanders
Copy link
Member Author

@wxtim, this should now build correctly. Please can you give it a whirl and a once-over.


.. tip::

You can see the result of this Jinja2 code by running the ``cylc view -p``
Copy link
Member

Choose a reason for hiding this comment

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

any reason why -p (which expands everything), not -j which just expands the jinja2?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think -p intelligently decides whether to use Jinja2 or EmPy pre-processing which makes it a little more generic / flexible.

Copy link
Member Author

Choose a reason for hiding this comment

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

-p and -j are otherwise equivalent:

for line in read_and_proc(
flow_file,
get_template_vars(options),
viewcfg={
'mark': options.mark,
'single': options.single,
'label': options.label,
'empy': options.empy or options.process,
'jinja2': options.jinja2 or options.process,
'contin': options.cat or options.process,
'inline': (
options.jinja2 or options.empy or
options.inline or options.process
),
},
opts=options,
):
print(line)

Comment on lines +27 to +30
# run this graph every year
P1Y = """
install[^] => prep
"""
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what this item illustrates in this example.

Copy link
Member Author

Choose a reason for hiding this comment

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

It demonstrates how to tie together bits of your workflow that follow regular cycling with bits that follow irregular cycling.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not all irregular cycling workflows are going to need this, but some will, so I added some text explaining the strftime and loop.first thinggies to help users with more advanced problems.

@oliver-sanders
Copy link
Member Author

Just waiting on the upstream PR...

@oliver-sanders
Copy link
Member Author

Done.

@oliver-sanders oliver-sanders merged commit dfa185e into cylc:master Sep 26, 2024
27 checks passed
@oliver-sanders oliver-sanders deleted the 6336 branch September 26, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

examples: cycle over irregular list of dates
3 participants