You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object model updates:
* Task/Batch/Project models updated
* A new method as_dict() introduced to access object as a dict
* New ways to retrieve the list of tasks/batches:
get_tasks and get_batches are the new generator methods for bulk retrieval
API:
* Isolated API access into a different class
* Enabled HTTP retry for certain error codes
* Improved error handling by differentiating exception types
Infra improvements:
* Enabled type hinting across the package
* New code standards applied via Pylint, flake8 and black
* Integrated pre-commit for a better/consistent developer experience
* publish.sh introduced for an automated publish to PyPI
* New pytest test cases are added
Documentation
* New Migration guide for v2
* New Developer Guide (how to setup repo env and configure pre-commit)
* Updated deployment and publishing guide
* Updated README for v2
* Made README to be available in PyPI
If you use earlier versions of the SDK, please refer to `v1.0.4 documentation <https://github.com/scaleapi/scaleapi-python-client/blob/release-1.0.4/README.rst>`_.
6
+
7
+
If you are migrating from earlier versions to v2, please refer to `Migration Guide to v2 <https://github.com/scaleapi/scaleapi-python-client/blob/master/docs/migration_guide.md>`_.
Passing in the applicable values into the function definition. The applicable fields and further information for each task type can be found in `Scale's API documentation`__.
print(task.status) # Task status ('pending', 'completed', 'error', 'canceled')
92
+
print(task.response) # If task is complete
76
93
77
94
List Tasks
78
95
^^^^^^^^^^
79
96
80
-
Retrieve a list of tasks, with optional filter by start and end date/time. Paginated with `next_token`. The return value is a `scaleapi.Tasklist`, which acts as a list, but also has fields for the total number of tasks, the limit and offset, and whether or not there's more. Check out `Scale's API documentation`__ for more information.
97
+
Retrieve a list of `Task` objects, with filters for: ``project_name``, ``batch_name``, ``type``, ``status``,
from scaleapi.tasks import TaskReviewStatus, TaskStatus
118
+
119
+
tasks = client.get_tasks(
120
+
project_name = "My Project",
121
+
created_after = "2020-09-08",
122
+
completed_before = "2021-04-01",
123
+
status = TaskStatus.Completed,
124
+
review_status = TaskReviewStatus.Accepted
125
+
)
126
+
127
+
# Iterating through the generator
128
+
for task in tasks:
129
+
# Download task or do something!
130
+
print(task.task_id)
131
+
132
+
# For retrieving results as a Task list
133
+
task_list = list(tasks)
134
+
print(f"{len(task_list))} tasks retrieved")
104
135
105
136
Cancel Task
106
137
^^^^^^^^^^^
107
138
108
-
Cancel a task given its id if work has not started on the task (task status is `Queued` in the UI). Check out `Scale's API documentation`__ for more information.
139
+
Cancel a task given its id if work has not started on the task (task status is ``Queued`` in the UI). Check out `Scale's API documentation`__ for more information.
0 commit comments