Skip to content

MRG:Allow extra wait time for Xvfb if needed #1142

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 3 commits into from
Jul 16, 2015
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Next release
* ENH: Added -newgrid input to Warp in AFNI (3dWarp wrapper) (https://github.com/nipy/nipype/pull/1128)
* FIX: Fixed AFNI Copy interface to use positional inputs as required (https://github.com/nipy/nipype/pull/1131)
* ENH: Added a check in Dcm2nii to check if nipype created the config.ini file and remove if true (https://github.com/nipy/nipype/pull/1132)
* ENH: Use a while loop to wait for Xvfb (up to a max wait time "xvfb_max_wait" in config file, default 10)
(https://github.com/nipy/nipype/pull/1142)

Release 0.10.0 (October 10, 2014)
============
Expand Down
3 changes: 3 additions & 0 deletions doc/users/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ Execution
all pending jobs and checking for job completion. To be nice to cluster
schedulers the default is set to 60 seconds.

*xvfb_max_wait*
Maximum time (in seconds) to wait for Xvfb to start, if the _redirect_x parameter of an Interface is True.

Example
~~~~~~~

Expand Down
10 changes: 7 additions & 3 deletions nipype/interfaces/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,13 @@ def run(self, **inputs):
xvfb_proc = subprocess.Popen(xvfb_cmd,
stdout=open(os.devnull),
stderr=open(os.devnull))
time.sleep(0.2) # give Xvfb time to start
if xvfb_proc.poll() is not None:
raise Exception('Error: Xvfb did not start')
wait_step = 0.2
wait_time = 0
while xvfb_proc.poll() is not None:
if wait_time > config.get('execution', 'xvfb_max_wait'):
raise Exception('Error: Xvfb did not start')
time.sleep(wait_step) # give Xvfb time to start
wait_time += wait_step

runtime.environ['DISPLAY'] = ':%s' % vdisplay_num

Expand Down
1 change: 1 addition & 0 deletions nipype/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
write_provenance = false
parameterize_dirs = true
poll_sleep_duration = 60
xvfb_max_wait = 10

[check]
interval = 1209600
Expand Down