#!/usr/bin/env python

import arvados

this_job = arvados.current_job()
this_task = arvados.current_task()
parser_path = arvados.util.git_checkout(
    url = this_job['script_parameters']['parser_url'],
    version = this_job['script_parameters']['parser_version'],
    path = 'parser')

stdoutdata, stderrdata = arvados.util.run_command(
    ["python", "demo.py"],
    cwd=parser_path)

out = arvados.CollectionWriter()
out.write(stdoutdata)
out.set_current_file_name('participant_traits.tsv')
this_task.set_output(out.finish())