Пример #1
0
 def __init__(self, 
         identifier: str, 
         is_default: bool, 
         base_path: str, 
         modules_folder: str, 
         provenance: BranchProvenance,
         properties: ObjectAnnotationSet, 
         workflows: List[WorkflowDescriptor] = list(), 
         head: Optional[WorkflowHandle] = None, 
         object_store: Optional[ObjectStore] = None,
         cache_size: int = DEFAULT_CACHE_SIZE
 ):
     """Initialize the branch handle.
     """
     super(OSBranchHandle, self).__init__(
         identifier=identifier,
         properties=properties,
         provenance=provenance
     )
     self.is_default = is_default
     self.base_path = base_path
     self.modules_folder = modules_folder
     self.object_store = init_value(object_store, DefaultObjectStore())
     self.workflows = init_value(workflows, list())
     self.head = head
     self.cache_size = cache_size if not cache_size is None else DEFAULT_CACHE_SIZE
     self.cache: List[WorkflowHandle] = list()
Пример #2
0
    def __init__(self,
                 identifier: str,
                 properties: PersistentAnnotationSet,
                 base_path: str,
                 branches: List[BranchHandle],
                 default_branch: Optional[BranchHandle],
                 object_store: ObjectStore = DefaultObjectStore(),
                 created_at: datetime = get_current_time(),
                 branch_index: Optional[str] = None,
                 branch_folder: Optional[str] = None,
                 modules_folder: Optional[str] = None):
        """Initialize the viztrail descriptor.

        Parameters
        ----------
        identifier : string
            Unique viztrail identifier
        properties: dict(string, any)
            Dictionary of user-defined properties
        base_path: string
            Identifier for folder containing viztrail resources
        object_store: vizier.core.io.base.ObjectStore, optional
            Object store implementation to access and maintain resources
        branches: list(vizier.viztrail.branch.BranchHandle)
            List of branches in the viztrail
        default_branch: vizier.viztrail.branch.BranchHandle
            Default branch for the viztrail
        created_at : datetime.datetime, optional
            Timestamp of project creation (UTC)
        branch_index: string, optional
            Path to branch index list
        branch_folder: string, optional
            Path to branches folder
        modules_folder: string, optional
            Path to modules folder
        """
        super(OSViztrailHandle, self).__init__(identifier=identifier,
                                               properties=properties,
                                               branches=branches,
                                               default_branch=default_branch,
                                               created_at=created_at)
        # Initizlize the object store and identifier for all subfolders.
        self.base_path = base_path
        self.object_store = object_store
        self.branch_folder = init_value(
            branch_folder, self.object_store.join(base_path, FOLDER_BRANCHES))
        self.branch_index = init_value(
            branch_index,
            self.object_store.join(self.branch_folder, OBJ_BRANCHINDEX))
        self.modules_folder = init_value(
            modules_folder, self.object_store.join(base_path, FOLDER_MODULES))
Пример #3
0
    def __init__(self,
                 identifier: str,
                 action: str,
                 package_id: Optional[str] = None,
                 command_id: Optional[str] = None,
                 created_at: Optional[datetime] = None):
        """Initialize the descriptor. If action is not the branch create action
        the package_id and command_id are expected to not be None.

        Parameters
        ----------
        identifier: string
            Unique workflow identifier
        action: string
            Identifier of the action that created the workflow version (create,
            insert, delete, or replace)
        package_id: string
            Identifier of the package the module command is from
        command_id: string
            Identifier of the module command
        create_at: datetime.datetime
            Timestamp of workflow creation (UTC)
        """
        if action != ACTION_CREATE and (package_id is None
                                        or command_id is None):
            raise ValueError('invalid workflow provenance information')
        self.identifier = identifier
        self.action = action
        self.package_id = package_id
        self.command_id = command_id
        self.created_at = init_value(created_at, get_current_time())
Пример #4
0
    def __init__(self,
                 identifier,
                 is_default,
                 base_path,
                 modules_folder,
                 provenance,
                 properties,
                 workflows=None,
                 head=None,
                 object_store=None,
                 cache_size=None):
        """Initialize the branch handle.

        Parameters
        ----------
        identifier: string
            Unique branch identifier
        is_default: bool
            True if this is the default branch for its viztrail
        base_path: string
            Path to branch resources folder
        modules_folder: string
            Path to module resources folder
        provenance: vizier.viztrail.branch.BranchProvenance
            Branch provenance information
        properties: vizier.core.annotation.base.ObjectAnnotationSet
            Branch property set
        workflows: list(vizier.viztrail.workflow.WorkflowDescriptor), optional
            List of descriptors for workflows in branch history
        head: vizier.viztrail.workflow.WorkflowHandle, optional
            Current at the head of the branch
        object_store: vizier.core.io.base.ObjectStore, optional
            Object store implementation to access and maintain resources
        """
        super(OSBranchHandle, self).__init__(identifier=identifier,
                                             properties=properties,
                                             provenance=provenance)
        self.is_default = is_default
        self.base_path = base_path
        self.modules_folder = modules_folder
        self.object_store = init_value(object_store, DefaultObjectStore())
        self.workflows = init_value(workflows, list())
        self.head = head
        self.cache_size = cache_size if not cache_size is None else DEFAULT_CACHE_SIZE
        self.cache = list()
Пример #5
0
    def __init__(self, object_path, object_store=None):
        """Initialize the path to the resource in the object store. By default
        annotation stes are persisted as files on the locak file system.

        Parameters
        ----------
        object_path: string
            Path to the resource
        object_store: vizier.core.io.base.ObjectStore, optional
            Object store to materialize annotations
        """
        self.object_path = object_path
        self.object_store = init_value(object_store, DefaultObjectStore())