taskcluster 103.0.0__tar.gz → 104.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taskcluster-103.0.0 → taskcluster-104.0.0}/PKG-INFO +101 -93
- {taskcluster-103.0.0 → taskcluster-104.0.0}/README.md +100 -92
- {taskcluster-103.0.0 → taskcluster-104.0.0}/pyproject.toml +1 -1
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/queue.py +5 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/webserver.py +1 -1
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/queue.py +5 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/webserver.py +1 -1
- {taskcluster-103.0.0 → taskcluster-104.0.0}/uv.lock +20 -20
- {taskcluster-103.0.0 → taskcluster-104.0.0}/.gitignore +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/CODE_OF_CONDUCT.md +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/CONTRIBUTING.md +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/LICENSE +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/release.sh +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/__init__.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/__init__.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/asyncclient.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/asyncutils.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/auth.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/authevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/awsprovisioner.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/download.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/ec2manager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/github.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/githubevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/hooks.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/hooksevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/index.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/login.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/notify.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/notifyevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/purgecache.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/queue.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/queueevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/reader_writer.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/retry.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/secrets.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/upload.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/workermanager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/aio/workermanagerevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/auth.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/authevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/awsprovisioner.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/client.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/download.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/ec2manager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/exceptions.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/__init__.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/_client_importer.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/__init__.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/_client_importer.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/auth.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/authevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/github.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/githubevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/hooks.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/hooksevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/index.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/notify.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/notifyevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/object.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/purgecache.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/queueevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/secrets.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/workermanager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/aio/workermanagerevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/auth.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/authevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/github.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/githubevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/hooks.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/hooksevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/index.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/notify.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/notifyevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/object.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/purgecache.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/queueevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/secrets.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/workermanager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/generated/workermanagerevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/github.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/githubevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/helper.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/hooks.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/hooksevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/index.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/login.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/notify.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/notifyevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/purgecache.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/queue.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/queueevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/retry.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/secrets.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/upload.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/utils.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/workermanager.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/taskcluster/workermanagerevents.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/aio/__init__.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/aio/test_client.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/aio/test_reader_writer.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/aio/test_upload_download.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/aio/test_upload_download_real.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/base.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/conftest.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/public.key +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/secret.key +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_client.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_exceptions.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_imports.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_upload_download.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_upload_download_real.py +0 -0
- {taskcluster-103.0.0 → taskcluster-104.0.0}/test/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taskcluster
|
|
3
|
-
Version:
|
|
3
|
+
Version: 104.0.0
|
|
4
4
|
Summary: Python client for Taskcluster
|
|
5
5
|
Project-URL: Homepage, https://github.com/taskcluster/taskcluster
|
|
6
6
|
Project-URL: Repository, https://github.com/taskcluster/taskcluster
|
|
@@ -63,10 +63,13 @@ Here is a simple set-up of an Index client:
|
|
|
63
63
|
|
|
64
64
|
```python
|
|
65
65
|
import taskcluster
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
|
|
67
|
+
index = taskcluster.Index(
|
|
68
|
+
{
|
|
69
|
+
"rootUrl": "https://tc.example.com",
|
|
70
|
+
"credentials": {"clientId": "id", "accessToken": "accessToken"},
|
|
71
|
+
}
|
|
72
|
+
)
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
The `rootUrl` option is required as it gives the Taskcluster deployment to
|
|
@@ -83,7 +86,7 @@ auth = taskcluster.Auth(taskcluster.optionsFromEnvironment())
|
|
|
83
86
|
Note that this function does not respect `TASKCLUSTER_PROXY_URL`. To use the Taskcluster Proxy from within a task:
|
|
84
87
|
|
|
85
88
|
```python
|
|
86
|
-
auth = taskcluster.Auth({
|
|
89
|
+
auth = taskcluster.Auth({"rootUrl": os.environ["TASKCLUSTER_PROXY_URL"]})
|
|
87
90
|
```
|
|
88
91
|
|
|
89
92
|
#### Authorized Scopes
|
|
@@ -96,7 +99,7 @@ in the `authorizedScopes` option.
|
|
|
96
99
|
|
|
97
100
|
```python
|
|
98
101
|
opts = taskcluster.optionsFromEnvironment()
|
|
99
|
-
opts[
|
|
102
|
+
opts["authorizedScopes"] = ["queue:create-task:highest:my-provisioner/my-worker-type"]
|
|
100
103
|
queue = taskcluster.Queue(opts)
|
|
101
104
|
```
|
|
102
105
|
|
|
@@ -128,8 +131,10 @@ request payload, and `query` is a dictionary of query arguments.
|
|
|
128
131
|
For example, in order to call an API method with query-string arguments:
|
|
129
132
|
|
|
130
133
|
```python
|
|
131
|
-
await queue.listTaskGroup(
|
|
132
|
-
|
|
134
|
+
await queue.listTaskGroup(
|
|
135
|
+
"JzTGxwxhQ76_Tt1dxkaG5g",
|
|
136
|
+
query={"continuationToken": previousResponse.get("continuationToken")},
|
|
137
|
+
)
|
|
133
138
|
```
|
|
134
139
|
|
|
135
140
|
|
|
@@ -142,9 +147,9 @@ To do so, use `buildUrl` or, for an API method that requires authentication, `bu
|
|
|
142
147
|
import taskcluster
|
|
143
148
|
|
|
144
149
|
index = taskcluster.Index(taskcluster.optionsFromEnvironment())
|
|
145
|
-
print(index.buildUrl(
|
|
150
|
+
print(index.buildUrl("findTask", "builds.v1.latest"))
|
|
146
151
|
secrets = taskcluster.Secrets(taskcluster.optionsFromEnvironment())
|
|
147
|
-
print(secret.buildSignedUrl(
|
|
152
|
+
print(secret.buildSignedUrl("get", "my-secret"))
|
|
148
153
|
```
|
|
149
154
|
|
|
150
155
|
Note that signed URLs are time-limited; the expiration can be set with the `signedUrlExpiration` option to the client constructor, or with the `expiration` keyword arguement to `buildSignedUrl`, both given in seconds.
|
|
@@ -163,9 +168,9 @@ to the start or expiry time - this is handled by the auth service directly.
|
|
|
163
168
|
import datetime
|
|
164
169
|
|
|
165
170
|
start = datetime.datetime.now()
|
|
166
|
-
expiry = start + datetime.timedelta(0,60)
|
|
167
|
-
scopes = [
|
|
168
|
-
name =
|
|
171
|
+
expiry = start + datetime.timedelta(0, 60)
|
|
172
|
+
scopes = ["ScopeA", "ScopeB"]
|
|
173
|
+
name = "foo"
|
|
169
174
|
|
|
170
175
|
credentials = taskcluster.createTemporaryCredentials(
|
|
171
176
|
# issuing clientId
|
|
@@ -179,7 +184,7 @@ credentials = taskcluster.createTemporaryCredentials(
|
|
|
179
184
|
# Scopes to grant the temporary credentials
|
|
180
185
|
scopes,
|
|
181
186
|
# credential name (optional)
|
|
182
|
-
name
|
|
187
|
+
name,
|
|
183
188
|
)
|
|
184
189
|
```
|
|
185
190
|
|
|
@@ -196,9 +201,9 @@ this library comes with two utility functions for this purposes.
|
|
|
196
201
|
|
|
197
202
|
```python
|
|
198
203
|
dateObject = taskcluster.fromNow("2 days 3 hours 1 minute")
|
|
199
|
-
|
|
204
|
+
# -> datetime.datetime(2017, 1, 21, 17, 8, 1, 607929)
|
|
200
205
|
dateString = taskcluster.fromNowJSON("2 days 3 hours 1 minute")
|
|
201
|
-
|
|
206
|
+
# -> '2017-01-21T17:09:23.240178Z'
|
|
202
207
|
```
|
|
203
208
|
|
|
204
209
|
By default it will offset the date time into the future, if the offset strings
|
|
@@ -206,8 +211,8 @@ are prefixed minus (`-`) the date object will be offset into the past. This is
|
|
|
206
211
|
useful in some corner cases.
|
|
207
212
|
|
|
208
213
|
```python
|
|
209
|
-
dateObject = taskcluster.fromNow("- 1 year 2 months 3 weeks 5 seconds")
|
|
210
|
-
|
|
214
|
+
dateObject = taskcluster.fromNow("- 1 year 2 months 3 weeks 5 seconds")
|
|
215
|
+
# -> datetime.datetime(2015, 10, 30, 18, 16, 50, 931161)
|
|
211
216
|
```
|
|
212
217
|
|
|
213
218
|
The offset string is ignorant of whitespace and case insensitive. It may also
|
|
@@ -232,10 +237,10 @@ deadline or doing something similar. This argument can also be passed as the
|
|
|
232
237
|
kwarg `dateObj`
|
|
233
238
|
|
|
234
239
|
```python
|
|
235
|
-
dateObject1 = taskcluster.fromNow("2 days 3 hours")
|
|
236
|
-
dateObject2 = taskcluster.fromNow("1 year", dateObject1)
|
|
237
|
-
taskcluster.fromNow("1 year", dateObj=dateObject1)
|
|
238
|
-
|
|
240
|
+
dateObject1 = taskcluster.fromNow("2 days 3 hours")
|
|
241
|
+
dateObject2 = taskcluster.fromNow("1 year", dateObject1)
|
|
242
|
+
taskcluster.fromNow("1 year", dateObj=dateObject1)
|
|
243
|
+
# -> datetime.datetime(2018, 1, 21, 17, 59, 0, 328934)
|
|
239
244
|
```
|
|
240
245
|
### Generating SlugIDs
|
|
241
246
|
|
|
@@ -249,14 +254,14 @@ just this.
|
|
|
249
254
|
|
|
250
255
|
```python
|
|
251
256
|
gen = taskcluster.stableSlugId()
|
|
252
|
-
sometask = gen(
|
|
253
|
-
assert gen(
|
|
254
|
-
assert gen(
|
|
257
|
+
sometask = gen("sometask")
|
|
258
|
+
assert gen("sometask") == sometask # same input generates same output
|
|
259
|
+
assert gen("sometask") != gen("othertask")
|
|
255
260
|
|
|
256
261
|
gen2 = taskcluster.stableSlugId()
|
|
257
|
-
sometask2 = gen(
|
|
262
|
+
sometask2 = gen("sometask")
|
|
258
263
|
assert sometask2 != sometask # but different slugId generators produce
|
|
259
|
-
|
|
264
|
+
# different output
|
|
260
265
|
```
|
|
261
266
|
|
|
262
267
|
### Scope Analysis
|
|
@@ -274,14 +279,11 @@ satisfied.
|
|
|
274
279
|
Example:
|
|
275
280
|
|
|
276
281
|
```python
|
|
277
|
-
requiredScopeSets = [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
]
|
|
281
|
-
assert scopesMatch([
|
|
282
|
-
assert scopesMatch(['scopeC:xyz'], requiredScopeSets)
|
|
283
|
-
assert not scopesMatch(['scopeA'], requiredScopeSets)
|
|
284
|
-
assert not scopesMatch(['scopeC'], requiredScopeSets)
|
|
282
|
+
requiredScopeSets = [["scopeA", "scopeB"], ["scopeC:*"]]
|
|
283
|
+
assert scopesMatch(["scopeA", "scopeB"], requiredScopeSets)
|
|
284
|
+
assert scopesMatch(["scopeC:xyz"], requiredScopeSets)
|
|
285
|
+
assert not scopesMatch(["scopeA"], requiredScopeSets)
|
|
286
|
+
assert not scopesMatch(["scopeC"], requiredScopeSets)
|
|
285
287
|
```
|
|
286
288
|
|
|
287
289
|
### Pagination
|
|
@@ -292,17 +294,21 @@ in your code:
|
|
|
292
294
|
|
|
293
295
|
```python
|
|
294
296
|
import taskcluster
|
|
295
|
-
|
|
297
|
+
|
|
298
|
+
queue = taskcluster.Queue({"rootUrl": "https://tc.example.com"})
|
|
296
299
|
i = 0
|
|
297
300
|
tasks = 0
|
|
298
|
-
outcome = queue.listTaskGroup(
|
|
299
|
-
while outcome.get(
|
|
300
|
-
print(
|
|
301
|
-
if outcome.get(
|
|
302
|
-
outcome = queue.listTaskGroup(
|
|
301
|
+
outcome = queue.listTaskGroup("JzTGxwxhQ76_Tt1dxkaG5g")
|
|
302
|
+
while outcome.get("continuationToken"):
|
|
303
|
+
print("Response %d gave us %d more tasks" % (i, len(outcome["tasks"])))
|
|
304
|
+
if outcome.get("continuationToken"):
|
|
305
|
+
outcome = queue.listTaskGroup(
|
|
306
|
+
"JzTGxwxhQ76_Tt1dxkaG5g",
|
|
307
|
+
query={"continuationToken": outcome.get("continuationToken")},
|
|
308
|
+
)
|
|
303
309
|
i += 1
|
|
304
|
-
tasks += len(outcome.get(
|
|
305
|
-
print(
|
|
310
|
+
tasks += len(outcome.get("tasks", []))
|
|
311
|
+
print("Task Group %s has %d tasks" % (outcome["taskGroupId"], tasks))
|
|
306
312
|
```
|
|
307
313
|
|
|
308
314
|
There's also an experimental feature to support built in automatic pagination
|
|
@@ -315,19 +321,22 @@ built and then counted:
|
|
|
315
321
|
|
|
316
322
|
```python
|
|
317
323
|
import taskcluster
|
|
318
|
-
|
|
324
|
+
|
|
325
|
+
queue = taskcluster.Queue({"rootUrl": "https://tc.example.com"})
|
|
319
326
|
|
|
320
327
|
responses = []
|
|
321
328
|
|
|
329
|
+
|
|
322
330
|
def handle_page(y):
|
|
323
|
-
print("%d tasks fetched" % len(y.get(
|
|
331
|
+
print("%d tasks fetched" % len(y.get("tasks", [])))
|
|
324
332
|
responses.append(y)
|
|
325
333
|
|
|
326
|
-
|
|
334
|
+
|
|
335
|
+
queue.listTaskGroup("JzTGxwxhQ76_Tt1dxkaG5g", paginationHandler=handle_page)
|
|
327
336
|
|
|
328
337
|
tasks = 0
|
|
329
338
|
for response in responses:
|
|
330
|
-
tasks += len(response.get(
|
|
339
|
+
tasks += len(response.get("tasks", []))
|
|
331
340
|
|
|
332
341
|
print("%d requests fetch %d tasks" % (len(responses), tasks))
|
|
333
342
|
```
|
|
@@ -342,10 +351,11 @@ dictionary argument or keyword arguments. Only one form is allowed.
|
|
|
342
351
|
|
|
343
352
|
```python
|
|
344
353
|
from taskcluster import client
|
|
345
|
-
|
|
354
|
+
|
|
355
|
+
qEvt = client.QueueEvents({rootUrl: "https://tc.example.com"})
|
|
346
356
|
# The following calls are equivalent
|
|
347
|
-
print(qEvt.taskCompleted({
|
|
348
|
-
print(qEvt.taskCompleted(taskId=
|
|
357
|
+
print(qEvt.taskCompleted({"taskId": "atask"}))
|
|
358
|
+
print(qEvt.taskCompleted(taskId="atask"))
|
|
349
359
|
```
|
|
350
360
|
|
|
351
361
|
Note that the client library does *not* provide support for interfacing with a Pulse server.
|
|
@@ -450,7 +460,7 @@ tc = TaskclusterConfig('https://community-tc.services.mozilla.com')
|
|
|
450
460
|
```python
|
|
451
461
|
from project import tc
|
|
452
462
|
|
|
453
|
-
tc.auth(client_id=
|
|
463
|
+
tc.auth(client_id="XXX", access_token="YYY")
|
|
454
464
|
```
|
|
455
465
|
|
|
456
466
|
3. at that point, you can load any service using the authenticated wrapper from anywhere in your code:
|
|
@@ -458,12 +468,14 @@ tc.auth(client_id='XXX', access_token='YYY')
|
|
|
458
468
|
```python
|
|
459
469
|
from project import tc
|
|
460
470
|
|
|
471
|
+
|
|
461
472
|
def sync_usage():
|
|
462
|
-
queue = tc.get_service(
|
|
473
|
+
queue = tc.get_service("queue")
|
|
463
474
|
queue.ping()
|
|
464
475
|
|
|
476
|
+
|
|
465
477
|
async def async_usage():
|
|
466
|
-
hooks = tc.get_service(
|
|
478
|
+
hooks = tc.get_service("hooks", use_async=True) # Asynchronous service class
|
|
467
479
|
await hooks.ping()
|
|
468
480
|
```
|
|
469
481
|
|
|
@@ -505,25 +517,22 @@ from taskcluster import Secrets
|
|
|
505
517
|
from taskcluster.helper import load_secrets
|
|
506
518
|
|
|
507
519
|
prod_config = load_secrets(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
existing={
|
|
519
|
-
'environment': 'dev',
|
|
520
|
-
}
|
|
520
|
+
Secrets({...}),
|
|
521
|
+
"project/foo/prod-config",
|
|
522
|
+
# We only need the common & backend parts
|
|
523
|
+
prefixes=["common", "backend"],
|
|
524
|
+
# We absolutely need a bugzilla token to run
|
|
525
|
+
required=["bugzilla_token"],
|
|
526
|
+
# Let's provide some default value for the environment
|
|
527
|
+
existing={
|
|
528
|
+
"environment": "dev",
|
|
529
|
+
},
|
|
521
530
|
)
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
531
|
+
# -> prod_config == {
|
|
532
|
+
# "environment": "production"
|
|
533
|
+
# "remote_log": "https://log.xx.com/payload",
|
|
534
|
+
# "bugzilla_token": "XXXX",
|
|
535
|
+
# }
|
|
527
536
|
```
|
|
528
537
|
|
|
529
538
|
In your task, you could do the following using `TaskclusterConfig` mentionned above (the class has a shortcut to use an authenticated `Secrets` service automatically):
|
|
@@ -532,22 +541,20 @@ In your task, you could do the following using `TaskclusterConfig` mentionned ab
|
|
|
532
541
|
from project import tc
|
|
533
542
|
|
|
534
543
|
prod_config = tc.load_secrets(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
'backend_url': 'http://localhost:8000',
|
|
544
|
-
}
|
|
544
|
+
"project/foo/prod-config",
|
|
545
|
+
# We only need the common & bot parts
|
|
546
|
+
prefixes=["common", "bot"],
|
|
547
|
+
# Let's provide some default value for the environment and backend_url
|
|
548
|
+
existing={
|
|
549
|
+
"environment": "dev",
|
|
550
|
+
"backend_url": "http://localhost:8000",
|
|
551
|
+
},
|
|
545
552
|
)
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
553
|
+
# -> prod_config == {
|
|
554
|
+
# "environment": "production"
|
|
555
|
+
# "remote_log": "https://log.xx.com/payload",
|
|
556
|
+
# "backend_url": "https://backend.foo.mozilla.com",
|
|
557
|
+
# }
|
|
551
558
|
```
|
|
552
559
|
|
|
553
560
|
To provide local secrets value, you first need to load these values as a dictionary (usually by reading a local file in your format of choice : YAML, JSON, ...) and providing the dictionary to `load_secrets` by using the `local_secrets` parameter:
|
|
@@ -559,14 +566,15 @@ import yaml
|
|
|
559
566
|
from taskcluster import Secrets
|
|
560
567
|
from taskcluster.helper import load_secrets
|
|
561
568
|
|
|
562
|
-
local_path =
|
|
569
|
+
local_path = "path/to/file.yml"
|
|
563
570
|
|
|
564
571
|
prod_config = load_secrets(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
572
|
+
Secrets({...}),
|
|
573
|
+
"project/foo/prod-config",
|
|
574
|
+
# We support an optional local file to provide some configuration without reaching Taskcluster
|
|
575
|
+
local_secrets=yaml.safe_load(open(local_path))
|
|
576
|
+
if os.path.exists(local_path)
|
|
577
|
+
else None,
|
|
570
578
|
)
|
|
571
579
|
```
|
|
572
580
|
|