Skip to content

FIX: TypeError bug for PBS process communication in python3 #1987

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

Merged
merged 1 commit into from
May 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions nipype/pipeline/plugins/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import os
from time import sleep
import subprocess

from ...interfaces.base import CommandLine
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
Expand Down Expand Up @@ -46,13 +45,12 @@ def __init__(self, **kwargs):
super(PBSPlugin, self).__init__(template, **kwargs)

def _is_pending(self, taskid):
# subprocess.Popen requires taskid to be a string
proc = subprocess.Popen(["qstat", str(taskid)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, e = proc.communicate()
result = CommandLine('qstat {}'.format(taskid),
environ=dict(os.environ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this line if you want to use the default environment

terminal_output='allatonce',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure 'allatonce' generates both stdout and stderr in the runtime object. Have you checked?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allatonce doesn't stream but still separates stdout and stderr

ignore_exception=True).run()
errmsg = 'Unknown Job Id' # %s' % taskid
return errmsg not in e
return errmsg not in result.runtime.stderr

def _submit_batchtask(self, scriptfile, node):
cmd = CommandLine('qsub', environ=dict(os.environ),
Expand Down