Skip to content

Commit

Permalink
Merge pull request #106 from mattions/improve_clone_docs
Browse files Browse the repository at this point in the history
Added example on how to clone and modify a task.
  • Loading branch information
QuicksilverMachine committed Nov 8, 2018
2 parents b2c22df + 9068db6 commit 44a0948
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
28 changes: 26 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ Task Examples
~~~~~~~~~~~~~

Single task
~~~~~~~~~~~
^^^^^^^^^^^

.. code:: python
Expand All @@ -1262,9 +1262,33 @@ Single task
# Task can also be ran by invoking .run() method on the draft task.
task.run()
Clone a task and run it with modification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sometimes it is convenient to take an already executed task and change
only some of the inputs, to then re-run it, using the clone method.
Note: the clone method has the parameter `run=True` by default, so
it is important to set it to `False` if modifications are needed.

.. code:: python
# Getting the old task by id
old_task = api.tasks.get(old_task_id)
# clone it without launching it.
new_task = old_task.clone(run=False)
# Modify the inputs
new_task.inputs['somekey'] = "new value"
# Save the new task, and run it.
new_task.save()
new_task.run()
Batch task
~~~~~~~~~~
^^^^^^^^^^

.. code:: python
Expand Down

0 comments on commit 44a0948

Please sign in to comment.