Example #1
0
    def __call__(self, **kwargs):
        kwargs = modify_paths(kwargs, relative=False)
        interface = self.interface()
        # Set the inputs early to get some argument checking
        interface.inputs.set(**kwargs)
        # Make a name for our node
        inputs = interface.inputs.get_hashval()
        hasher = hashlib.new('md5')
        hasher.update(pickle.dumps(inputs))
        dir_name = '%s-%s' % (interface.__class__.__module__.replace(
            '.', '-'), interface.__class__.__name__)
        job_name = hasher.hexdigest()
        node = Node(interface, name=job_name)
        node.base_dir = os.path.join(self.base_dir, dir_name)

        cwd = os.getcwd()
        try:
            out = node.run()
        finally:
            # node.run() changes to the node directory - if something goes wrong
            # before it cds back you would end up in strange places
            os.chdir(cwd)
        if self.callback is not None:
            self.callback(dir_name, job_name)
        return out
Example #2
0
    def __call__(self, **kwargs):
        kwargs = modify_paths(kwargs, relative=False)
        interface = self.interface()
        # Set the inputs early to get some argument checking
        interface.inputs.set(**kwargs)
        # Make a name for our node
        inputs = interface.inputs.get_hashval()
        hasher = hashlib.new('md5')
        hasher.update(pickle.dumps(inputs))
        dir_name = '%s-%s' % (interface.__class__.__module__.replace('.', '-'),
                              interface.__class__.__name__)
        job_name = hasher.hexdigest()
        node = Node(interface, name=job_name)
        node.base_dir = os.path.join(self.base_dir, dir_name)

        cwd = os.getcwd()
        try:
            out = node.run()
        finally:
            # node.run() changes to the node directory - if something goes wrong
            # before it cds back you would end up in strange places
            os.chdir(cwd)
        if self.callback is not None:
            self.callback(dir_name, job_name)
        return out
Example #3
0
 def __call__(self, **kwargs):
     kwargs = modify_paths(kwargs, relative=False)
     interface = self.interface()
     # Set the inputs early to get some argument checking
     interface.inputs.set(**kwargs)
     # Make a name for our node
     inputs = interface.inputs.get_hashval()
     hasher = hashlib.new('md5')
     hasher.update(pickle.dumps(inputs))
     dir_name = '%s-%s' % (interface.__class__.__module__.replace(
         '.', '-'), interface.__class__.__name__)
     job_name = hasher.hexdigest()
     node = Node(interface, name=job_name)
     node.base_dir = os.path.join(self.base_dir, dir_name)
     out = node.run()
     if self.callback is not None:
         self.callback(dir_name, job_name)
     return out
Example #4
0
 def __call__(self, **kwargs):
     kwargs = modify_paths(kwargs, relative=False)
     interface = self.interface()
     # Set the inputs early to get some argument checking
     interface.inputs.set(**kwargs)
     # Make a name for our node
     inputs = interface.inputs.get_hashval()
     hasher = hashlib.new('md5')
     hasher.update(pickle.dumps(inputs))
     dir_name = '%s-%s' % (interface.__class__.__module__.replace('.', '-'),
                           interface.__class__.__name__)
     job_name = hasher.hexdigest()
     node = Node(interface, name=job_name)
     node.base_dir = os.path.join(self.base_dir, dir_name)
     out = node.run()
     if self.callback is not None:
         self.callback(dir_name, job_name)
     return out