Skip to content

Commit 4e87f7a

Browse files
committed
Merge branch 'release-0.13.0'
2 parents 586d1ce + 253f7cf commit 4e87f7a

20 files changed

Lines changed: 1008 additions & 139 deletions

.github/workflows/ci_python_compatibility.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
9+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1010

1111
steps:
1212
- name: Check out the source code

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Change Log
55
All notable changes to this project will be documented in this file.
66
This project adheres to `Semantic Versioning <http://semver.org/>`_.
77

8+
0.13.0
9+
******
10+
11+
Added
12+
-----
13+
14+
- Support for connecting multiple conduits to an outgoing port
15+
- Checkpointing support (preview release)
16+
- Improved error messages
17+
18+
819
0.12.0
920
******
1021

README.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.. image:: https://readthedocs.org/projects/ymmsl-python/badge/?version=latest
2-
:target: https://ymmsl-python.readthedocs.io/en/latest/?badge=latest
1+
.. image:: https://readthedocs.org/projects/ymmsl-python/badge/?version=master
2+
:target: https://ymmsl-python.readthedocs.io/en/latest/?badge=master
33
:alt: Documentation Build Status
44

55
.. image:: https://github.com/multiscale/ymmsl-python/workflows/continuous_integration/badge.svg
@@ -14,10 +14,6 @@
1414
:target: https://www.codacy.com/gh/multiscale/ymmsl-python/dashboard
1515
:alt: Test Coverage
1616

17-
.. image:: https://requires.io/github/multiscale/ymmsl-python/requirements.svg?branch=master
18-
:target: https://requires.io/github/multiscale/ymmsl-python/requirements/?branch=master
19-
:alt: Requirements Status
20-
2117
.. image:: https://zenodo.org/badge/153272345.svg
2218
:target: https://zenodo.org/badge/latestdoi/153272345
2319

@@ -38,7 +34,7 @@ Documentation
3834
*************
3935

4036
This is an ordinary Python library that can be installed via pip. It requires
41-
Python 3.6 or higher. More information is available in the `online
37+
Python 3.7 or higher. More information is available in the `online
4238
documentation for ymmsl-python <https://ymmsl-python.readthedocs.io>`_.
4339

4440
Development
@@ -51,6 +47,7 @@ something is unclear, please file an issue.
5147
Legal
5248
*****
5349

54-
ymmsl_python is Copyright 2018-2022 Netherlands eScience Center and University
55-
of Amsterdam. Licensed under the Apache 2.0 license.
50+
ymmsl_python is Copyright 2018-2023 Netherlands eScience Center and University
51+
of Amsterdam, and Copyright 2022-2023 ITER Organisation. Licensed under the
52+
Apache 2.0 license.
5653

docs/conf.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
# Add any Sphinx extension module names here, as strings. They can be
3434
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3535
# ones.
36-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
36+
extensions = [
37+
"sphinx.ext.autosectionlabel",
38+
'sphinx.ext.autodoc',
39+
'sphinx.ext.napoleon',
40+
]
3741

3842
# Add any paths that contain templates here, relative to this directory.
3943
templates_path = ['_templates']
@@ -49,17 +53,17 @@
4953

5054
# General information about the project.
5155
project = u'yMMSL Python bindings'
52-
copyright = u'2018-2022, Netherlands eScience Center and University of Amsterdam'
56+
copyright = u'2018-2023, Netherlands eScience Center and University of Amsterdam, 2022-2023 ITER Organisation'
5357
author = u'Lourens Veen'
5458

5559
# The version info for the project you're documenting, acts as replacement for
5660
# |version| and |release|, also used in various other places throughout the
5761
# built documents.
5862
#
5963
# The short X.Y version.
60-
version = u'0.12.0'
64+
version = u'0.13.0'
6165
# The full version, including alpha/beta/rc tags.
62-
release = u'0.12.0'
66+
release = u'0.13.0'
6367

6468
# The language for content autogenerated by Sphinx. Refer to documentation
6569
# for a list of supported languages.

docs/example.ymmsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ implementations:
3131
my.micro_model:
3232
modules: gcc openmpi
3333
execution_model: openmpi
34+
executable: /home/user/model2
3435

3536
resources:
3637
macro:
3738
threads: 1
3839
micro:
3940
mpi_processes: 8
4041

42+
checkpoints:
43+
at_end: true
44+
simulation_time:
45+
- every: 50

docs/ymmsl_python.rst

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,38 @@ interpret these fields, e.g. to extract the component and port name parts.
189189
Note that the format allows specifying a slot here, but this is currently not
190190
supported and illegal in MUSCLE3.
191191

192+
Multicast conduits
193+
^^^^^^^^^^^^^^^^^^
194+
195+
In yMMSL you can specify that an output port is connected to multiple input
196+
ports. When a message is sent on the output port, it is copied and delivered to
197+
all connected input ports. This is called multicast and is expressed as
198+
follows:
199+
200+
.. code-block:: yaml
201+
:caption: Specifying multicast in yMMSL
202+
203+
conduits:
204+
sender.port:
205+
- receiver1.port
206+
- receiver2.port
207+
208+
This multicast conduit is converted to a a list of conduits sharing the same
209+
sender:
210+
211+
.. code-block:: python
212+
:caption: Multicast conduits in python code
213+
214+
from pathlib import Path
215+
import ymmsl
216+
217+
config = ymmsl.load(Path('multicast.ymmsl'))
218+
219+
conduits = config.model.conduits
220+
print(len(conduits)) # output: 2
221+
print(conduits[0]) # output: Conduit(sender.port -> receiver1.port)
222+
print(conduits[1]) # output: Conduit(sender.port -> receiver2.port)
223+
192224
Settings
193225
--------
194226

@@ -330,6 +362,44 @@ Finally, if you need to do something complicated, you can write an inline script
330362
to start the implementation. This currently only works for non-MPI programs
331363
however.
332364

365+
Keeps state for next use
366+
````````````````````````
367+
368+
Implementations may indicate if they carry state between reuses. This is
369+
currently only used for `checkpoints`_, but might see further
370+
use in the future (e.g. for load balancers). There are three possible values
371+
an implementation may indicate.
372+
373+
Necessary
374+
This implementation remembers state between consecutive iterations of the
375+
reuse loop. That state is required for the proper execution of the
376+
implementation.
377+
378+
This is the default value when not specified.
379+
380+
**Example:** A micro model simulating an enclosed volume, where every reuse
381+
the boundary conditions are updated by the connected macro model. This micro
382+
model must keep track of the state inside the simulated volume between
383+
iterations of the reuse loop.
384+
385+
No
386+
This implementation has no state between consecutive iterations of the reuse
387+
loop.
388+
389+
**Example:** A data converter that receives on an ``F_INIT`` port, transforms
390+
the data and outputs it on an ``O_F`` port. The transformation is only
391+
dependent on the information of the ``F_INIT`` message.
392+
393+
Helpful
394+
This implementation remembers state between consecutive iterations of the
395+
reuse loop. However, this state is not required for proper execution.
396+
397+
**Example:** A simulation of a fluid in a pipe with obstacles. The simulation
398+
converges much faster when starting from the solution of the previous
399+
iteration. However, the same solution can still be found when starting from
400+
scratch.
401+
402+
333403
Resources
334404
---------
335405

@@ -404,6 +474,72 @@ Computing section in the MUSCLE3 documentation
404474
<https://muscle3.readthedocs.io/en/latest/distributed_execution.html#high-performance-computing>`_.
405475

406476

477+
Checkpoints
478+
-----------
479+
480+
In yMMSL you can specify if you expect the workflow to create checkpoints. Note
481+
that all implementations in your workflow must support checkpointing, MUSCLE3
482+
will generate an error for you otherwise. See the `documentation for MUSCLE3
483+
<https://muscle3.readthedocs.io/en/latest/>`_ on checkpointing for details on
484+
enabling checkpointing for an implementation.
485+
486+
Checkpoint triggers
487+
```````````````````
488+
489+
In yMMSL you have three possible checkpoint triggers:
490+
491+
``at_end``
492+
Create a checkpoint just before the instance shuts down. This can be a useful
493+
checkpoint if you intend to resume the workflow at some later point, e.g.
494+
when you wish to simulate a longer time span. This trigger is either on or
495+
off, specified with a boolean ``true`` or ``false`` (default) in the
496+
configuration.
497+
498+
``simulation_time``
499+
Create checkpoints based on the passed simulation time. This can only work
500+
properly if there is a shared concept of simulated time in the workflow.
501+
502+
``wallclock_time``
503+
Create checkpoints based on the passed wall clock time (also called `elapsed
504+
real time <https://en.wikipedia.org/wiki/Elapsed_real_time>`_). This method
505+
is not perfect and may result in missed checkpoints in certain coupling
506+
scenarios. See the MUSCLE3 documentation for a discussion of the limitations.
507+
508+
When you use any of the time-based triggers, you must also specify at what
509+
moments a checkpoint is expected. MUSCLE3 will then snapshot as soon as
510+
possible **after** reaching the specified times. You may indicate specific
511+
moments with ``at``-rules, but can also create repetitive checkpoints.
512+
513+
.. code-block:: yaml
514+
:caption: Example checkpoint definition
515+
516+
checkpoints:
517+
at_end: true
518+
simulation_time:
519+
- at: [1.2, 1.4]
520+
- every: 1
521+
wallclock_time:
522+
- every: 60
523+
stop: 600
524+
- every: 600
525+
start: 600
526+
stop: 3600
527+
- every: 1800
528+
start: 3600
529+
530+
Above example demonstrates all possible checkpoint options. The workflow will
531+
create checkpoints:
532+
533+
- At the end: ``at_end: true``.
534+
- Every second of passed simulated time (``t=0,1,2,...``), and additionally at
535+
``t=1.2`` and ``t=1.4``.
536+
- Every minute of real elapsed time, for the first 10 minutes; then every 10
537+
minutes for the remainder of the first hour; then every 30 minutes until the
538+
end.
539+
540+
See the API documentation for :py:class:`~ymmsl.CheckpointRangeRule` for more
541+
details on the behaviour of the repetitive checkpoints.
542+
407543
Examples
408544
--------
409545

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='ymmsl',
11-
version='0.12.0',
11+
version='0.13.0',
1212
description="Python bindings for the YAML version of the Multiscale Modeling and Simulation Language",
1313
long_description=readme + '\n\n',
1414
author="Lourens Veen",
@@ -29,15 +29,15 @@
2929
'License :: OSI Approved :: Apache Software License',
3030
'Natural Language :: English',
3131
'Programming Language :: Python :: 3',
32-
'Programming Language :: Python :: 3.6',
3332
'Programming Language :: Python :: 3.7',
3433
'Programming Language :: Python :: 3.8',
3534
'Programming Language :: Python :: 3.9',
3635
'Programming Language :: Python :: 3.10',
3736
],
37+
python_requires='>=3.7, <4',
3838
test_suite='tests',
3939
install_requires=[
40-
'ruamel.yaml<=0.16.12',
41-
'yatiml>=0.9.0,<0.10.0'
40+
'ruamel.yaml<=0.17.21,!=0.17.5',
41+
'yatiml>=0.10.0,<0.11.0'
4242
],
4343
)

0 commit comments

Comments
 (0)