Пример #1
0
 def show_history(self, history_id, contents=False):
     """
     Get details of a given history. By default, just get the history meta
     information. If ``contents`` is set to ``True``, get the complete list of
     datasets in the given history.
     """
     return Client._get(self, id=history_id, contents=contents)
Пример #2
0
 def show_dataset(self, history_id, dataset_id):
     """
     Get details about a given history dataset. The required ``history_id``
     can be obtained from the datasets's history content details.
     """
     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._get(self, url=url)
Пример #3
0
    def show_library(self, library_id, contents=False):
        """
        Get information about a library.

        If want to get contents of the library (rather than just the library details),
        set ``contents`` to ``True``.

        Return a list of JSON formatted dicts containing library details.
        """
        return Client._get(self, id=library_id, contents=contents)
Пример #4
0
    def get_workflows(self):
        """
        Get a list of all workflows

        :rtype: list
        :return: A list of workflow dicts. 
                 For example::

                   [{u'id': u'92c56938c2f9b315',
                     u'name': u'Simple',
                     u'url': u'/api/workflows/92c56938c2f9b315'}]

        """
        return Client._get(self)
Пример #5
0
    def get_users(self, deleted=False):
        """
        Get a list of all registered users. If ``deleted`` is set to ``True``,
        get a list of deleted users.

        :rtype: list
        :return: A list of dicts with user details. 
                 For example::

                   [{u'email': u'*****@*****.**',
                     u'id': u'dda47097d9189f15',
                     u'url': u'/api/users/dda47097d9189f15'}]

        """
        return Client._get(self, deleted=deleted)
Пример #6
0
    def show_workflow(self, workflow_id):
        """
        Display information needed to run a workflow

        :type workflow_id: string
        :param workflow_id: Encoded workflow ID

        :rtype: list
        :return: A description of the workflow and its inputs as a JSON object.
                 For example::

                  {u'id': u'92c56938c2f9b315',
                   u'inputs': {u'23': {u'label': u'Input Dataset', u'value': u''}},
                   u'name': u'Simple',
                   u'url': u'/api/workflows/92c56938c2f9b315'}

        """
        return Client._get(self, id=workflow_id)
Пример #7
0
    def get_libraries(self, library_id=None, name=None, deleted=False):
        """
        Get all the libraries or filter for specific one(s) via the provided name or ID.
        Provide only one argument: ``name`` or ``library_id``.

        If ``name`` is set and multiple names match the given name, all the
        libraries matching the argument will be returned.

        Return a list of JSON formatted dicts each containing basic information
        about a library.
        """
        libraries = Client._get(self, deleted=deleted)
        if name is not None or library_id is not None:
            filtered_libs = []
            for lib in libraries:
                if name == lib["name"] or library_id == lib["id"]:
                    filtered_libs.append(lib)
                # Library ID's are unique so break now that the lib was found
                if library_id is not None:
                    break
            libraries = filtered_libs
        return libraries
Пример #8
0
    def get_histories(self, history_id=None, name=None, deleted=False):
        """
        Get all histories or filter the specific one(s) via the provided ``name``
        or ``history_id``. Provide only one argument, ``name`` or ``history_id``,
        but not both.

        If ``deleted`` is set to ``True``, return histories that have been deleted.

        Return a list of history element dicts. If more than one history
        matches the given ``name``, return the list of all the histories with the
        given name.
        """
        histories = Client._get(self, deleted=deleted)
        if name is not None or history_id is not None:
            filtered_hists = []
            for history in histories:
                if name == history['name'] or history_id == history['id']:
                    filtered_hists.append(history)
                    # History ID's are unique so break now that the hist was found
                    if history_id is not None:
                        break
            histories = filtered_hists
        return histories
Пример #9
0
 def show_dataset(self, dataset_id, deleted=False):
     """
     Display information about and/or content of a dataset. This can be a
     history or a library dataset.
     """
     return Client._get(self, id=dataset_id, deleted=deleted)
Пример #10
0
 def show_user(self, user_id, deleted=False):
     """
     Display information about a user. If ``deleted`` is set to ``True``,
     display information about a deleted user.
     """
     return Client._get(self, id=user_id, deleted=deleted)