Example #1
0
    def persist_workflow_description(self, description):
        '''Persists the workflow description and updates `workflow_type`.

        Parameters
        ----------
        description: tmlib.workflow.tmaps.description.WorkflowDescription
            description of the workflow
        '''
        self.workflow_type = description.type
        with YamlWriter(self._workflow_descriptor_file) as f:
            f.write(description.to_dict())
Example #2
0
 def _update_handles(self):
     handles_files = []
     # Create new .handles files for added modules
     old_handles_files = glob.glob(
         os.path.join(self.location, 'handles', '*%s' % HANDLES_SUFFIX))
     new_handles_files = list()
     for h in self.handles:
         filename = self._get_handles_file(h.name)
         new_handles_files.append(filename)
         with YamlWriter(filename) as f:
             f.write(h.description.to_dict())
     # Remove .handles file that are no longer in the pipeline
     for f in old_handles_files:
         if f not in new_handles_files:
             os.remove(f)
Example #3
0
 def _create_pipe_file(self, filename):
     logger.info('create pipeline descriptor file: %s', filename)
     pipe = {
         'input': {
             'channels': list(),
             'objects': list()
         },
         'pipeline': list(),
         'output': {
             'objects': list()
         }
     }
     with YamlWriter(filename) as f:
         f.write(pipe)
     return pipe
Example #4
0
 def _update_pipe(self):
     pipe_file = self._get_pipe_file()
     with YamlWriter(pipe_file) as f:
         f.write(self.pipe.description.to_dict())