Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SessionBasedScript requires that TaskCollections have an attribute output_dir #583

Closed
riccardomurri opened this issue Nov 22, 2016 · 1 comment

Comments

@riccardomurri
Copy link
Collaborator

riccardomurri commented Nov 22, 2016

Currently, the SessionBasedScript class assumes each task given to it has a .output_dir
attribute, including TaskCollection instances and other tasks where .would_output == False.

Here is an example of the traceback::

exercise_E.py: [2016-11-22 16:43:07] CRITICAL: AttributeError: 'TwoStageWorkflow' object has no attribute 'output_dir'
Traceback (most recent call last):
  File "/home/rmurri/gc3/gc3pie/gc3libs/cmdline.py", line 471, in run
    return cli.app.CommandLineApp.run(self)
  File "/home/rmurri/.virtualenvs/gc3pie-dev/local/lib/python2.7/site-packages/cli/app.py", line 245, in run
    return self.post_run(returned)
  File "/home/rmurri/.virtualenvs/gc3pie-dev/local/lib/python2.7/site-packages/cli/app.py", line 241, in run
    returned = self.main(*args)
  File "/home/rmurri/gc3/gc3pie/gc3libs/cmdline.py", line 1279, in _main
    self.process_args()
  File "/home/rmurri/gc3/gc3pie/gc3libs/cmdline.py", line 950, in process_args
    self._add_new_tasks(new_jobs)
  File "/home/rmurri/gc3/gc3pie/gc3libs/cmdline.py", line 1018, in _add_new_tasks
    self._fix_output_dir(task, task.jobname)
  File "/home/rmurri/gc3/gc3pie/gc3libs/cmdline.py", line 1026, in _fix_output_dir
    task.output_dir = task.output_dir.replace('NAME', name)
AttributeError: 'TwoStageWorkflow' object has no attribute 'output_dir'

The problem seems to be that _fix_output_dir tries to replace/patch
the result of task.output_dir unconditionally.

@riccardomurri
Copy link
Collaborator Author

The easy workaround is just to initialize every TaskCollection
instance with a (possibly bogus) output_dir attribute::

def new_tasks(self, extra):
  # ...
  return [
    TwoStagedTaskCollection([], output_dir="not-used")
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant