4 class TaskOutputDir(object):
5 """Keep-backed directory for staging outputs of Crunch tasks.
7 Example, in a crunch task whose output is a file called "out.txt"
14 out = arvados.crunch.TaskOutputDir()
15 with open(os.path.join(out.path, 'out.txt'), 'w') as f:
17 arvados.current_task().set_output(out.manifest_text())
20 self.path = os.environ['TASK_KEEPMOUNT_TMP']
25 def manifest_text(self):
26 snapshot = os.path.join(self.path, '.arvados#collection')
27 return json.load(open(snapshot))['manifest_text']