| 1 |
.. _timer_management_examples: |
| 2 |
|
| 3 |
Timer Management |
| 4 |
---------------- |
| 5 |
|
| 6 |
These examples demonstrate how to create, list, and delete timers with the SDK. |
| 7 |
|
| 8 |
Create a timer |
| 9 |
~~~~~~~~~~~~~~ |
| 10 |
|
| 11 |
This script creates a new timer, on source and destination collections provided |
| 12 |
via the command-line. It syncs an input file or directory between the two. |
| 13 |
|
| 14 |
The script assumes that the path being synced is the same on the source and |
| 15 |
destination for simplicity. |
| 16 |
|
| 17 |
.. note:: |
| 18 |
This example does not handle ``data_access`` scope requirements. |
| 19 |
See the later example to handle this. |
| 20 |
|
| 21 |
.. literalinclude:: create_timer.py |
| 22 |
:caption: ``create_timer.py`` [:download:`download <create_timer.py>`] |
| 23 |
:language: python |
| 24 |
|
| 25 |
List timers |
| 26 |
~~~~~~~~~~~ |
| 27 |
|
| 28 |
This script lists your current timers. |
| 29 |
|
| 30 |
.. literalinclude:: list_timers.py |
| 31 |
:caption: ``list_timers.py`` [:download:`download <list_timers.py>`] |
| 32 |
:language: python |
| 33 |
|
| 34 |
Delete a timer |
| 35 |
~~~~~~~~~~~~~~ |
| 36 |
|
| 37 |
This script deletes a timer by ID. |
| 38 |
|
| 39 |
.. literalinclude:: delete_timer.py |
| 40 |
:caption: ``delete_timer.py`` [:download:`download <delete_timer.py>`] |
| 41 |
:language: python |
| 42 |
|
| 43 |
Create a timer with ``data_access`` |
| 44 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 45 |
|
| 46 |
This script is similar to the ``create_timer.py`` example above. However, it |
| 47 |
also handles ``data_access`` scope requirements for the source and destination |
| 48 |
collections. |
| 49 |
|
| 50 |
Discovering ``data_access`` requirements requires the use of a |
| 51 |
``TransferClient`` to look up the collections. |
| 52 |
|
| 53 |
As in the simpler example, this script creates a new timer, on source and |
| 54 |
destination collections provided via the command-line. It syncs an input |
| 55 |
file or directory between the two, and assumes that the path is the same on the |
| 56 |
source and destination. |
| 57 |
|
| 58 |
.. literalinclude:: create_timer_data_access.py |
| 59 |
:caption: ``create_timer_data_access.py`` [:download:`download <create_timer_data_access.py>`] |
| 60 |
:language: python |