Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a068e0

Browse files
committed
docs(pipelines): simplify download
This uses a context instead of inventing your own stream handler whichmakes the code simpler and should be fine for most use cases.Signed-off-by: Paul Spooren <mail@aparcar.org>
1 parent74b3ddc commit9a068e0

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

‎docs/gl_objects/pipelines_and_jobs.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,8 @@ Get the artifacts of a job::
301301
You can download artifacts as a stream. Provide a callable to handle the
302302
stream::
303303

304-
class Foo(object):
305-
def __init__(self):
306-
self._fd = open('artifacts.zip', 'wb')
307-
308-
def __call__(self, chunk):
309-
self._fd.write(chunk)
310-
311-
target = Foo()
312-
build_or_job.artifacts(streamed=True, action=target)
313-
del(target) # flushes data on disk
304+
with open("archive.zip", "wb") as f:
305+
build_or_job.artifacts(streamed=True, action=f.write)
314306

315307
You can also directly stream the output into a file, and unzip it afterwards::
316308

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp