diff options
| author | Greg Hill <greg.hill@rackspace.com> | 2015-10-28 09:07:58 -0500 |
|---|---|---|
| committer | Greg Hill <greg.hill@rackspace.com> | 2016-01-25 15:04:34 -0600 |
| commit | 5ce07b2de15cbbd417748edd3fac12a166152aea (patch) | |
| tree | 3db2c372c10f5a5b7eaef32d804d428642af7105 /doc/source | |
| parent | 31764bfb9646e8ede4d0c6ef75888e9f33cb03e4 (diff) | |
| download | taskflow-5ce07b2de15cbbd417748edd3fac12a166152aea.tar.gz | |
Retrieve the store from flowdetails as well, if it exists
Gives users a more permanent way to provide an initial set of
arguments to a flow.
Change-Id: Ib9c3d60882548120d467a645bbac9be78408bac3
Implements: blueprint flow-details-keep-store
Diffstat (limited to 'doc/source')
| -rw-r--r-- | doc/source/jobs.rst | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/source/jobs.rst b/doc/source/jobs.rst index 6d0be30..55d343f 100644 --- a/doc/source/jobs.rst +++ b/doc/source/jobs.rst @@ -175,6 +175,66 @@ might look like: time.sleep(coffee_break_time) ... +There are a few ways to provide arguments to the flow. The first option is to +add a ``store`` to the flowdetail object in the +:py:class:`logbook <taskflow.persistence.models.LogBook>`. + +You can also provide a ``store`` in the +:py:class:`job <taskflow.jobs.base.Job>` itself when posting it to the +job board. If both ``store`` values are found, they will be combined, +with the :py:class:`job <taskflow.jobs.base.Job>` ``store`` +overriding the :py:class:`logbook <taskflow.persistence.models.LogBook>` +``store``. + +.. code-block:: python + + import uuid + + from taskflow import engines + from taskflow.persistence import backends as persistence_backends + from taskflow.persistence import models + from taskflow.jobs import backends as job_backends + + + ... + persistence = persistence_backends.fetch({ + "connection': "mysql", + "user": ..., + "password": ..., + }) + board = job_backends.fetch('my-board', { + "board": "zookeeper", + }, persistence=persistence) + + book = models.LogBook('my-book', uuid.uuid4()) + + flow_detail = models.FlowDetail('my-job', uuid.uuid4()) + book.add(flow_detail) + + connection = persistence.get_connection() + connection.save_logbook(book) + + flow_detail.meta['store'] = {'a': 1, 'c': 3} + + job_details = { + "flow_uuid": flow_detail.uuid, + "store": {'a': 2, 'b': 1} + } + + engines.save_factory_details(flow_detail, flow_factory, + factory_args=[], + factory_kwargs={}, + backend=persistence) + + jobboard = get_jobboard(zk_client) + jobboard.connect() + job = jobboard.post('my-job', book=book, details=job_details) + + # the flow global parameters are now the combined store values + # {'a': 2, 'b': 1', 'c': 3} + ... + + Types ===== |
