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

Safely handle possible None value encountered in processing and execution of post-job action arguments #5050

Merged
merged 2 commits into from Nov 21, 2017

Conversation

Projects
None yet
5 participants
@erasche
Member

erasche commented Nov 21, 2017

Seen in freiburg. Can share all variable values if checking for none is not the right solution.

@erasche erasche added this to the 18.01 milestone Nov 21, 2017

@martenson

This comment has been minimized.

Member

martenson commented Nov 21, 2017

The name of this PR will help nobody in the 18.01 release notes. ;)

@erasche erasche changed the title from Handle possibly None v to Safely handle possible None value encountered in processing and execution of post-job action arguments Nov 21, 2017

@erasche

This comment has been minimized.

Member

erasche commented Nov 21, 2017

Better? ;)

@@ -228,7 +228,7 @@ def execute(cls, app, sa_session, action, job, replacement_dict):
for dataset_assoc in job.output_datasets:
if action.output_name == '' or dataset_assoc.name == action.output_name:
for k, v in action.action_arguments.items():
if v != '':
if v and v != '':

This comment has been minimized.

@nsoranzo

nsoranzo Nov 21, 2017

Member

This is equivalent to just:

if v:

By looking at the following code it seems that v could be a number, so if v == 0 the following code won't be executed, which seems to be fine to me due to the if at line 236, but worth to note.

This comment has been minimized.

@erasche

erasche Nov 21, 2017

Member

Good point, thanks @nsoranzo

@dannon dannon merged commit ce45849 into galaxyproject:dev Nov 21, 2017

7 checks passed

api test Build finished. 317 tests run, 4 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
framework test Build finished. 162 tests run, 0 skipped, 0 failed.
Details
integration test Build finished. 58 tests run, 0 skipped, 0 failed.
Details
lgtm analysis: JavaScript No alert changes
Details
selenium test Build finished. 100 tests run, 1 skipped, 0 failed.
Details
toolshed test Build finished. 577 tests run, 0 skipped, 0 failed.
Details
@dannon

This comment has been minimized.

Member

dannon commented Nov 21, 2017

@erasche I'd be interested in knowing what the situation was where this was None, but this is definitely a fine, more defensive conditional.

@bgruening

This comment has been minimized.

Member

bgruening commented Nov 21, 2017

@dannon

Traceback (most recent call last):
  File "/usr/local/galaxy/galaxy-dist/lib/galaxy/jobs/runners/__init__.py", line 630, in finish_job
    job_state.job_wrapper.finish(stdout, stderr, exit_code)
  File "/usr/local/galaxy/galaxy-dist/lib/galaxy/jobs/__init__.py", line 1350, in finish
    ActionBox.execute(self.app, self.sa_session, pja.post_job_action, job)
  File "/usr/local/galaxy/galaxy-dist/lib/galaxy/jobs/actions/post.py", line 416, in execute
    ActionBox.actions[pja.action_type].execute(app, sa_session, pja, job, replacement_dict)
  File "/usr/local/galaxy/galaxy-dist/lib/galaxy/jobs/actions/post.py", line 233, in execute
    if v[0] == 'c':
TypeError: 'NoneType' object has no attribute '__getitem__'

@bgruening bgruening deleted the erasche:fix-ufr-7036 branch Nov 21, 2017

@erasche

This comment has been minimized.

Member

erasche commented Nov 21, 2017

utvalg_335

utvalg_336
utvalg_337
utvalg_338
utvalg_339

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