1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 from builtins import object
10 class TaskOutputDir(object):
11 """Keep-backed directory for staging outputs of Crunch tasks.
13 Example, in a crunch task whose output is a file called "out.txt"
20 out = arvados.crunch.TaskOutputDir()
21 with open(os.path.join(out.path, 'out.txt'), 'w') as f:
23 arvados.current_task().set_output(out.manifest_text())
25 @util._deprecated('3.0', 'arvados-cwl-runner or the containers API')
27 self.path = os.environ['TASK_KEEPMOUNT_TMP']
32 def manifest_text(self):
33 snapshot = os.path.join(self.path, '.arvados#collection')
34 return json.load(open(snapshot))['manifest_text']