コード例 #1
0
 def description(self) -> Description:
     """Get a description of the resource type."""
     manager: WorkflowManager = self._workflow_manager()
     if manager is None:
         raise ScopeError(
             'Out of scope. Managing context no longer exists!')
     return manager.tasks[self.uid()].description()
コード例 #2
0
 def description(self) -> Description:
     """Get a description of the resource type."""
     context = self._context()
     if context is None:
         raise ScopeError(
             'Out of scope. Managing context no longer exists!')
     return context.item(self.uid()).description()
コード例 #3
0
ファイル: workflow.py プロジェクト: SCALE-MS/scale-ms
 def manager(self) -> 'WorkflowManager':
     manager = self._workflow_manager()
     if manager is None:
         raise ScopeError('Out of scope. Managing context no longer exists!')
     else:
         if not isinstance(manager, WorkflowManager):
             raise APIError('Bug: ItemView._workflow_manager must weakly reference '
                            'a WorkflowManager.')
     return manager
コード例 #4
0
    def result(self):
        """Get a local object of the tasks's result type.

        .. todo:: Forces dependency resolution.

        """
        context = self._context()
        if context is None:
            raise ScopeError(
                'Out of scope. Managing context no longer exists!')
        return context.item(self.uid()).result()
コード例 #5
0
    def done(self) -> bool:
        """Check the status of the task.

        Returns:
            true if the task has finished.

        """
        context = self._context()
        if context is None:
            raise ScopeError(
                'Out of scope. Managing context no longer exists!')
        return context.item(self.uid()).done()
コード例 #6
0
    def done(self) -> bool:
        """Check the status of the task.

        Returns:
            true if the task has finished.

        """
        manager: WorkflowManager = self._workflow_manager()
        if manager is None:
            raise ScopeError(
                'Out of scope. Managing context no longer exists!')
        return manager.tasks[self.uid()].done()
コード例 #7
0
    def result(self):
        """Get a local object of the tasks's result type.

        .. todo:: Forces dependency resolution.

        """
        manager: WorkflowManager = self._workflow_manager()
        if manager is None:
            raise ScopeError(
                'Out of scope. Managing context no longer exists!')
        # TODO: What is the public interface to the tasks or completion status?
        # Note: We want to keep the View object as lightweight as possible, such
        # as storing just the weak ref to the manager, and the item identifier.
        return manager.tasks[self.uid()].result()
コード例 #8
0
    def __getattr__(self, item):
        """Proxy attribute accessor for special task members.

        If the workflow element provides the requested interface, the managing
        Context will provide appropriate access. For "result" attributes, the
        returned reference supports the Future interface.
        """
        # We don't actually want to do this check here, but this is essentially what
        # needs to happen:
        #     assert hasattr(self.description().type().result_description().type(), item)
        context = self._context()
        if context is None:
            raise ScopeError(
                'Out of scope. Managing context no longer available!')
        task = context.item(self.uid())  # type: Task
        try:
            return getattr(task, item)
        except KeyError as e:
            raise