Created
November 19, 2015 20:26
-
-
Save chrisgorgo/0cd489059434389d3c71 to your computer and use it in GitHub Desktop.
Try to replicate nipype bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| orange:nipype_test filo$ ./test.py | |
| orange:nipype_test filo$ ls -al /tmp/was_run | |
| -rw-r--r-- 1 filo wheel 0 Nov 19 12:21 /tmp/was_run | |
| orange:nipype_test filo$ rm -rf /tmp/was_run | |
| orange:nipype_test filo$ python simple_interface.py | |
| gzip test.txt | |
| orange:nipype_test filo$ ls -al /tmp/was_run | |
| ls: /tmp/was_run: No such file or directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from nipype.interfaces.base import ( | |
| TraitedSpec, | |
| CommandLineInputSpec, | |
| CommandLine, | |
| File | |
| ) | |
| import os | |
| class GZipInputSpec(CommandLineInputSpec): | |
| input_file = File(desc="File", exists=True, mandatory=True, argstr="%s") | |
| class GZipOutputSpec(TraitedSpec): | |
| output_file = File(desc = "Zip file", exists = True) | |
| class GZipTask(CommandLine): | |
| input_spec = GZipInputSpec | |
| output_spec = GZipOutputSpec | |
| cmd = 'gzip' | |
| def _list_outputs(self): | |
| outputs = self.output_spec().get() | |
| outputs['output_file'] = os.path.abspath(self.inputs.input_file + ".gz") | |
| return outputs | |
| if __name__ == '__main__': | |
| zipper = GZipTask(input_file='test.txt') | |
| print zipper.cmdline | |
| zipper.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| open("/tmp/was_run", "w").close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment