コード例 #1
0
ファイル: __init__.py プロジェクト: nebiolabs/planemo
def update_repository_for(ctx, tsi, id, repo_config):
    # TODO: enforce no "type" change.
    from bioblend.galaxy.client import Client
    description = repo_config.get("description", None)
    long_description = repo_config.get("long_description", None)
    remote_repository_url = repo_config.get("remote_repository_url", None)
    homepage_url = repo_config.get("homepage_url", None)
    categories = repo_config.get("categories", [])
    category_ids = find_category_ids(tsi, categories)

    _ensure_shed_description(description)

    kwds = dict(
        name=repo_config["name"],
        synopsis=description,
    )
    if long_description is not None:
        kwds["description"] = long_description
    if remote_repository_url is not None:
        kwds["remote_repository_url"] = remote_repository_url
    if homepage_url is not None:
        kwds["homepage_url"] = homepage_url
    if category_ids is not None:
        kwds['category_ids[]'] = category_ids
    repo = Client._put(tsi.repositories, id=id, payload=kwds)
    return repo
コード例 #2
0
ファイル: __init__.py プロジェクト: AAFC-MBB/bioblend
    def update_history(self, history_id, name=None, annotation=None, **kwds):
        """
        Update history metadata information. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type name: str
        :param name: Replace history name with the given string

        :type annotation: str
        :param annotation: Replace history annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history as deleted

        :type published: bool
        :param published: Mark or unmark history as published

        :type importable: bool
        :param importable: Mark or unmark history as importable

        :type tags: list
        :param tags: Replace history tags with the given list

        :rtype: int
        :return: status code
        """
        kwds['name'] = name
        kwds['annotation'] = annotation
        return Client._put(self, kwds, id=history_id).status_code
コード例 #3
0
ファイル: __init__.py プロジェクト: AAFC-MBB/bioblend
    def update_dataset(self, history_id, dataset_id, **kwds):
        """
        Update history dataset metadata. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_id: str
        :param dataset_id: Id of the dataset

        :type name: str
        :param name: Replace history dataset name with the given string

        :type annotation: str
        :param annotation: Replace history dataset annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset as visible

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        # Append the dataset_id to the base history contents URL
        url = '/'.join([url, dataset_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #4
0
    def update_group(self,
                     group_id,
                     group_name=None,
                     user_ids=[],
                     role_ids=[]):
        """
        Update a group.

        :type group_id: str
        :param group_id: Encoded group ID

        :type group_name: str
        :param group_name: A new name for the group. If None, the group name is
          not changed.

        :type user_ids: list
        :param user_ids: New list of encoded user IDs for the group. It will
          substitute the previous list of users (with [] if not specified)

        :type role_ids: list
        :param role_ids: New list of encoded role IDs for the group. It will
          substitute the previous list of roles (with [] if not specified)
        """
        payload = {
            'name': group_name,
            'user_ids': user_ids,
            'role_ids': role_ids
        }
        return Client._put(self, payload, id=group_id)
コード例 #5
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def update_history(self, history_id, name=None, annotation=None, **kwds):
        """
        Update history metadata information. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type name: str
        :param name: Replace history name with the given string

        :type annotation: str
        :param annotation: Replace history annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history as deleted

        :type published: bool
        :param published: Mark or unmark history as published

        :type importable: bool
        :param importable: Mark or unmark history as importable

        :type tags: list
        :param tags: Replace history tags with the given list

        :rtype: int
        :return: status code
        """
        kwds['name'] = name
        kwds['annotation'] = annotation
        return Client._put(self, kwds, id=history_id).status_code
コード例 #6
0
ファイル: __init__.py プロジェクト: AAFC-MBB/bioblend
    def update_dataset_collection(self, history_id, dataset_collection_id, **kwds):
        """
        Update history dataset collection metadata. Some of the attributes that
        can be modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_collection_id: str
        :param dataset_collection_id: Encoded dataset_collection ID

        :type name: str
        :param name: Replace history dataset collection name with the given
          string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset collection as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset collection as visible

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        url = '/'.join([url, "dataset_collections", dataset_collection_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #7
0
ファイル: __init__.py プロジェクト: AjitPS/bioblend
    def update_group(self, group_id, group_name=None, user_ids=[], role_ids=[]):
        """
        Update a group.

        :type group_id: str
        :param group_id: Encoded group ID

        :type group_name: str
        :param group_name: A new name for the group. If None, the group name is
          not changed.

        :type user_ids: list
        :param user_ids: New list of encoded user IDs for the group. It will
          substitute the previous list of users (with [] if not specified)

        :type role_ids: list
        :param role_ids: New list of encoded role IDs for the group. It will
          substitute the previous list of roles (with [] if not specified)
        """
        payload = {
            'name': group_name,
            'user_ids': user_ids,
            'role_ids': role_ids
        }
        return Client._put(self, payload, id=group_id)
コード例 #8
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def update_dataset(self, history_id, dataset_id, **kwds):
        """
        Update history dataset metadata. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_id: str
        :param dataset_id: Id of the dataset

        :type name: str
        :param name: Replace history dataset name with the given string

        :type annotation: str
        :param annotation: Replace history dataset annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset as visible

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        # Append the dataset_id to the base history contents URL
        url = '/'.join([url, dataset_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #9
0
    def update_dataset_collection(self, history_id, dataset_collection_id,
                                  **kwds):
        """
        Update history dataset collection metadata. Some of the attributes that
        can be modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_collection_id: str
        :param dataset_collection_id: Encoded dataset_collection ID

        :type name: str
        :param name: Replace history dataset collection name with the given
          string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset collection as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset collection as visible

        :rtype: dict
        :return: the updated dataset collection attributes

        .. warning::
            The return value was changed in BioBlend v0.8.0, previously it was
            the status code (type int).
        """
        url = self.gi._make_url(self, history_id, contents=True)
        url = '/'.join([url, "dataset_collections", dataset_collection_id])
        return Client._put(self, payload=kwds, url=url)
コード例 #10
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def update_dataset_collection(self, history_id, dataset_collection_id, **kwds):
        """
        Update history dataset collection metadata. Some of the attributes that
        can be modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_collection_id: str
        :param dataset_collection_id: Encoded dataset_collection ID

        :type name: str
        :param name: Replace history dataset collection name with the given
          string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset collection as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset collection as visible

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        url = '/'.join([url, "dataset_collections", dataset_collection_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #11
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def update_group(self, group_id, group_name=None, user_ids=[], role_ids=[]):
        """
        Update a group.

        :type group_id: str
        :param group_id: Encoded group ID

        :type group_name: str
        :param group_name: A new name for the group. If None, the group name is
          not changed.

        :type user_ids: list
        :param user_ids: New list of encoded user IDs for the group. It will
          substitute the previous list of users (with [] if not specified)

        :type role_ids: list
        :param role_ids: New list of encoded role IDs for the group. It will
          substitute the previous list of roles (with [] if not specified)

        :rtype: int
        :return: status code
        """
        payload = {}
        payload['name'] = group_name
        payload['user_ids'] = user_ids
        payload['role_ids'] = role_ids
        return Client._put(self, payload, id=group_id).status_code
コード例 #12
0
ファイル: __init__.py プロジェクト: nebiolabs/planemo
def update_repository_for(ctx, tsi, id, repo_config):
    # TODO: enforce no "type" change.
    from bioblend.galaxy.client import Client
    description = repo_config.get("description", None)
    long_description = repo_config.get("long_description", None)
    remote_repository_url = repo_config.get("remote_repository_url", None)
    homepage_url = repo_config.get("homepage_url", None)
    categories = repo_config.get("categories", [])
    category_ids = find_category_ids(tsi, categories)

    _ensure_shed_description(description)

    kwds = dict(
        name=repo_config["name"],
        synopsis=description,
    )
    if long_description is not None:
        kwds["description"] = long_description
    if remote_repository_url is not None:
        kwds["remote_repository_url"] = remote_repository_url
    if homepage_url is not None:
        kwds["homepage_url"] = homepage_url
    if category_ids is not None:
        kwds['category_ids[]'] = category_ids
    repo = Client._put(tsi.repositories, id=id, payload=kwds)
    return repo
コード例 #13
0
    def export_history(self,
                       history_id,
                       gzip=True,
                       include_hidden=False,
                       include_deleted=False,
                       wait=False):
        """
        Start a job to create an export archive for the given history.

        :type history_id: str
        :param history_id: history ID

        :type gzip: bool
        :param gzip: create .tar.gz archive if ``True``, else .tar

        :type include_hidden: bool
        :param include_hidden: whether to include hidden datasets
          in the export

        :type include_deleted: bool
        :param include_deleted: whether to include deleted datasets
          in the export

        :type wait: bool
        :param wait: if ``True``, block until the export is ready; else, return
          immediately

        :rtype: str
        :return: ``jeha_id`` of the export, or empty if ``wait`` is ``False``
          and the export is not ready.
        """
        params = {
            'gzip': gzip,
            'include_hidden': include_hidden,
            'include_deleted': include_deleted,
        }
        url = '%s/exports' % self.gi._make_url(self, history_id)
        while True:
            try:
                r = Client._put(self, {}, url=url, params=params)
            except ConnectionError as e:
                if e.status_code == 202:  # export is not ready
                    if wait:
                        time.sleep(1)
                    else:
                        return ''
                else:
                    raise
            else:
                break
        jeha_id = r['download_url'].rsplit('/', 1)[-1]
        return jeha_id
コード例 #14
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def add_group_role(self, group_id, role_id):
        """
        Add a role to the given group.

        :type group_id: str
        :param group_id: Encoded group ID

        :type role_id: str
        :param role_id: Encoded role ID to add to the group

        :rtype: dict
        :return: Added group role's info
        """
        url = '/'.join([self.gi._make_url(self, group_id), 'roles', role_id])
        return Client._put(self, {}, url=url).json()
コード例 #15
0
ファイル: __init__.py プロジェクト: Intel-HSS/bioblend
    def add_group_user(self, group_id, user_id):
        """
        Add a user to the given group.

        :type group_id: str
        :param group_id: Encoded group ID

        :type user_id: str
        :param user_id: Encoded user ID to add to the group

        :rtype: dict
        :return: Added group user's info
        """
        url = '/'.join([self.gi._make_url(self, group_id), 'users', user_id])
        return Client._put(self, dict(), url=url).json()
コード例 #16
0
ファイル: __init__.py プロジェクト: jmchilton/bioblend
    def update_dataset_collection(self, history_id, dataset_collection_id, **kwds):
        """
        Update history dataset collection metadata. Some of the attributes that
        can be modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_collection_id: str
        :param dataset_collection_id: Encoded dataset_collection ID

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        url = "/".join([url, "dataset_collections", dataset_collection_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #17
0
ファイル: __init__.py プロジェクト: jmchilton/bioblend
    def update_dataset(self, history_id, dataset_id, **kwds):
        """
        Update history dataset metadata. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_id: str
        :param dataset_id: Id of the dataset

        :rtype: int
        :return: status code
        """
        url = self.gi._make_url(self, history_id, contents=True)
        # Append the dataset_id to the base history contents URL
        url = "/".join([url, dataset_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #18
0
ファイル: __init__.py プロジェクト: AAFC-MBB/bioblend
    def export_history(self, history_id, gzip=True, include_hidden=False,
                       include_deleted=False, wait=False):
        """
        Start a job to create an export archive for the given history.

        :type history_id: str
        :param history_id: history ID

        :type gzip: bool
        :param gzip: create .tar.gz archive if ``True``, else .tar

        :type include_hidden: bool
        :param include_hidden: whether to include hidden datasets
          in the export

        :type include_deleted: bool
        :param include_deleted: whether to include deleted datasets
          in the export

        :type wait: bool
        :param wait: if ``True``, block until the export is ready; else, return
          immediately

        :rtype: str
        :return: ``jeha_id`` of the export, or empty if ``wait`` is ``False``
          and the export is not ready.
        """
        params = {
            'gzip': gzip,
            'include_hidden': include_hidden,
            'include_deleted': include_deleted,
        }
        url = '%s/exports' % self.gi._make_url(self, history_id)
        while True:
            r = Client._put(self, {}, url=url, params=params)
            if not wait or r.status_code == 200:
                break
            time.sleep(1)
        contents = r.json()
        if contents:
            jeha_id = contents['download_url'].rsplit('/', 1)[-1]
        else:
            jeha_id = ''  # export is not ready
        return jeha_id
コード例 #19
0
ファイル: __init__.py プロジェクト: cariaso/bioblend
    def update_dataset_collection(self, history_id, dataset_collection_id, **kwds):
        """
        Update history dataset metadata. Only a subset of the available
        metadata parameters for modification are documented below currently.

        :type history_id: string
        :param history_id: Encoded history ID
        :type name: string
        :param name: Replace history dataset collection name with the given string
        :type deleted: boolean
        :param deleted: Mark or unmark history dataset collection as deleted.
        :type visible: boolean
        :param visible: Mark or unmark history dataset collection as visible.

        :rtype: status_code (int)
        """
        url = self.gi._make_url(self, history_id, contents=True)
        url = '/'.join([url, "dataset_collections", dataset_collection_id])
        return Client._put(self, payload=kwds, url=url).status_code
コード例 #20
0
    def update_dataset(self, history_id, dataset_id, **kwds):
        """
        Update history dataset metadata. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type dataset_id: str
        :param dataset_id: Id of the dataset

        :type name: str
        :param name: Replace history dataset name with the given string

        :type genome_build: str
        :param genome_build: Replace history dataset genome build (dbkey)

        :type annotation: str
        :param annotation: Replace history dataset annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history dataset as deleted

        :type visible: bool
        :param visible: Mark or unmark history dataset as visible

        :rtype: dict
        :return: details of the updated dataset (for Galaxy release_15.01 and
            earlier only the updated attributes)

        .. warning::
            The return value was changed in BioBlend v0.8.0, previously it was
            the status code (type int).
        """
        url = self.gi._make_url(self, history_id, contents=True)
        # Append the dataset_id to the base history contents URL
        url = '/'.join([url, dataset_id])
        return Client._put(self, payload=kwds, url=url)
コード例 #21
0
    def update_history(self, history_id, name=None, annotation=None):
        """
        Update history metadata information. Current attributes that can be modified
        for a history 'name' and 'annotation'.

        :type history_id: string
        :param history_id: Encoded history ID
        :type name: string
        :param name: Replace history with the given string
        :type annotation: string
        :param annotation: Replace history annotation with given string

        :rtype: status_code (int)

        """

        payload = {}
        if name:
            payload['name'] = name
        if annotation:
            payload['annotation'] = annotation

        return Client._put(self, payload, id=history_id)
コード例 #22
0
ファイル: __init__.py プロジェクト: gvlproject/bioblend
    def run_invocation_step_action(self, workflow_id, invocation_id, step_id, action):
        """ Execute an action for an active workflow invocation step. The
        nature of this action and what is expected will vary based on the
        the type of workflow step (the only currently valid action is True/False
        for pause steps).

        :type workflow_id: str
        :param workflow_id: Encoded workflow ID

        :type invocation_id: str
        :param invocation_id: Encoded workflow invocation ID

        :type step_id: str
        :param step_id: Encoded workflow invocation step ID

        :type action: object
        :param action: Action to use when updating state, semantics depends on
           step type.

        """
        url = self._invocation_step_url(workflow_id, invocation_id, step_id)
        payload = {"action": action}
        return Client._put(self, payload, url=url)
コード例 #23
0
ファイル: __init__.py プロジェクト: CarlosBorroto/bioblend
    def update_history(self, history_id, name=None,annotation=None):
        """
        Update history metadata information. Current attributes that can be modified
        for a history 'name' and 'annotation'. 

        :type history_id: string
        :param history_id: Encoded history ID
        :type name: string
        :param name: Replace history with the given string
        :type annotation: string
        :param annotation: Replace history annotation with given string

        :rtype: status_code (int)

        """        

        payload = {}
        if name:
            payload['name'] = name
        if annotation:
            payload['annotation'] = annotation
            
        return Client._put(self, payload, id=history_id)
コード例 #24
0
    def update_history(self, history_id, name=None, annotation=None, **kwds):
        """
        Update history metadata information. Some of the attributes that can be
        modified are documented below.

        :type history_id: str
        :param history_id: Encoded history ID

        :type name: str
        :param name: Replace history name with the given string

        :type annotation: str
        :param annotation: Replace history annotation with given string

        :type deleted: bool
        :param deleted: Mark or unmark history as deleted

        :type published: bool
        :param published: Mark or unmark history as published

        :type importable: bool
        :param importable: Mark or unmark history as importable

        :type tags: list
        :param tags: Replace history tags with the given list

        :rtype: dict
        :return: details of the updated history (for Galaxy release_15.01 and
            earlier only the updated attributes)

        .. warning::
            The return value was changed in BioBlend v0.8.0, previously it was
            the status code (type int).
        """
        kwds['name'] = name
        kwds['annotation'] = annotation
        return Client._put(self, kwds, id=history_id)
コード例 #25
0
ファイル: __init__.py プロジェクト: nuwang/bioblend
    def run_invocation_step_action(self, workflow_id, invocation_id, step_id,
                                   action):
        """ Execute an action for an active workflow invocation step. The
        nature of this action and what is expected will vary based on the
        the type of workflow step (the only currently valid action is True/False
        for pause steps).

        :type workflow_id: str
        :param workflow_id: Encoded workflow ID

        :type invocation_id: str
        :param invocation_id: Encoded workflow invocation ID

        :type step_id: str
        :param step_id: Encoded workflow invocation step ID

        :type action: object
        :param action: Action to use when updating state, semantics depends on
           step type.

        """
        url = self._invocation_step_url(workflow_id, invocation_id, step_id)
        payload = {"action": action}
        return Client._put(self, payload, url=url)