Skip to content

Commit 12a40cc

Browse files
authored
Merge pull request #1092 from aparcar/aparcar-patch-1
Update pipelines_and_jobs.rst
2 parents 424a8cb + 9a068e0 commit 12a40cc

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)