当前位置: 首页>>代码示例>>Python>>正文


Python GirderClient.token方法代码示例

本文整理汇总了Python中girder_client.GirderClient.token方法的典型用法代码示例。如果您正苦于以下问题:Python GirderClient.token方法的具体用法?Python GirderClient.token怎么用?Python GirderClient.token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在girder_client.GirderClient的用法示例。


在下文中一共展示了GirderClient.token方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _update_girder

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
    def _update_girder(taskflow, body):
        taskflow = to_taskflow(taskflow)
        taskflow_id = taskflow['id']
        girder_token = taskflow['girder_token']
        girder_api_url = taskflow['girder_api_url']

        client = GirderClient(apiUrl=girder_api_url)
        client.token = girder_token

        client = _create_girder_client(girder_api_url, girder_token)

        # If this is a retry then we have already create a task get it from
        # the current tasks headers.
        if body['retries'] > 0:
            taskflow_task_id = \
                current_task.request.headers[TASKFLOW_TASK_ID_HEADER]

            # Celery always fires the postrun handler with a state of SUCCESS
            # for retries. So we need to save the retries here so we can
            # determine in the postrun handler if the task is really complete.
            current_task.request.headers[TASKFLOW_RETRY_HEADER] \
                = body['retries']
        else:
                # This is a new task so create a taskflow task instance
            body = {
                'celeryTaskId': body['id'],
                'name': body['task']
            }
            url = 'taskflows/%s/tasks' % taskflow_id
            r = client.post(url, data=json.dumps(body))
            taskflow_task_id = r['_id']
        return taskflow, taskflow_task_id
开发者ID:Kitware,项目名称:cumulus,代码行数:34,代码来源:__init__.py

示例2: _taskflow_task_finished

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def _taskflow_task_finished(taskflow, taskflow_task_id):
    girder_token = taskflow['girder_token']
    girder_api_url = taskflow['girder_api_url']

    client = GirderClient(apiUrl=girder_api_url)
    client.token = girder_token
    url = 'taskflows/%s/tasks/%s/finished' % (taskflow.id, taskflow_task_id)

    return client.put(url)
开发者ID:Kitware,项目名称:cumulus,代码行数:11,代码来源:__init__.py

示例3: upload_file

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def upload_file(cluster, girder_token, file, path):
    """
    Upload a file to a cluster

    :param cluster: The cluster to upload to.
    :param girder_tokebn: The Grider token for Girder access.
    :param file: The Girder file object.
    :param path: The path on the cluster to upload to.
    """
    girder_client = GirderClient(apiUrl=cumulus.config.girder.baseUrl)
    girder_client.token = girder_token
    with get_connection(girder_token, cluster) as conn:
        conn.makedirs(os.path.dirname(path))
        _upload_file(conn, girder_client, file, path)
开发者ID:Kitware,项目名称:cumulus,代码行数:16,代码来源:upload.py

示例4: main

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def main(args=None):
    parser = argparse.ArgumentParser(
        description='Mount Girder filesystem assetstore.')
    parser.add_argument('--api-url', required=True, default=None,
                        help='full URL to the RESTful API of Girder server')
    parser.add_argument('--username', required=False, default=None)
    parser.add_argument('--password', required=False, default=None)
    parser.add_argument('--api-key', required=False, default=None)
    parser.add_argument('--token', required=False, default=None)
    parser.add_argument('-c', default='remote', choices=['remote', 'direct'],
                        help='command to run')
    parser.add_argument('--foreground', dest='foreground',
                        action='store_true')
    parser.add_argument('--hostns', dest='hostns', action='store_true')
    parser.add_argument('local_folder', help='path to local target folder')
    parser.add_argument('remote_folder', help='Girder\'s folder id')

    args = parser.parse_args()

    gc = GirderClient(apiUrl=args.api_url)
    if args.token:
        gc.token = args.token
    elif args.api_key:
        gc.authenticate(apiKey=args.api_key)
    elif args.username and args.password:
        gc.authenticate(username=args.username, password=args.password)
    else:
        raise RuntimeError("You need to specify apiKey or user/pass")

    if args.hostns:
        targetns = os.path.join(os.environ.get('HOSTDIR', '/'),
                                'proc/1/ns/mnt')
        with open(targetns) as fd:
            setns(fd, CLONE_NEWNS)

    if args.c == 'remote':
        FUSE(RESTGirderFS(args.remote_folder, gc), args.local_folder,
             foreground=args.foreground, ro=True, allow_other=True)
    elif args.c == 'direct':
        FUSE(LocalGirderFS(args.remote_folder, gc), args.local_folder,
             foreground=args.foreground, ro=True, allow_other=True)
    else:
        print('No implementation for command %s' % args.c)
开发者ID:data-exp-lab,项目名称:girder_fs,代码行数:45,代码来源:__main__.py

示例5: download_path

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def download_path(cluster_connection, girder_token, parent, path,
                  assetstore_url, assetstore_id, upload=False, include=None,
                  exclude=None):
    """
    Download a given path on a cluster into an assetstore.

    :params cluster_connection: The cluster connection to access the cluster.
    :params girder_token: The Girder token to use to access Girder.
    :params parent: The target folder to import the path into.
    :params path: The path on the cluster to download.
    :params assetstore_url: The url for the assetstore to use for the import.
    :params assetstore_id: The id of the asseststore to import into.
    :params upload: Indicate if the import should upload the file data or just
                    the metadata, the default is False.
    :params include: List of include regexs
    :params exclude: List of exclude regexs,
    """
    girder_client = GirderClient(apiUrl=cumulus.config.girder.baseUrl)
    girder_client.token = girder_token

    _import_path(cluster_connection, girder_client, parent, path,
                 assetstore_url, assetstore_id, upload=upload, include=include,
                 exclude=exclude)
开发者ID:Kitware,项目名称:cumulus,代码行数:25,代码来源:download.py

示例6: _create_girder_client

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def _create_girder_client(girder_api_url, girder_token):
    client = GirderClient(apiUrl=girder_api_url)
    client.token = girder_token

    return client
开发者ID:sunhughees,项目名称:HPCCloud,代码行数:7,代码来源:paraview.py

示例7: upload_path

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
def upload_path(cluster_connection, girder_token, folder_id, path):
    girder_client = GirderClient(apiUrl=cumulus.config.girder.baseUrl)
    girder_client.token = girder_token
    cluster_connection.makedirs(path)

    _upload_path(cluster_connection, girder_client, folder_id, path)
开发者ID:Kitware,项目名称:cumulus,代码行数:8,代码来源:upload.py

示例8: float

# 需要导入模块: from girder_client import GirderClient [as 别名]
# 或者: from girder_client.GirderClient import token [as 别名]
            lon_name = d

    contour_data = {
        'gridWidth': lon_select_index,
        'gridHeight': lat_select_index,
        'x0': float(data.variables[lon_name][0]),
        'y0': float(data.variables[lat_name][0]),
        'dx': float(data.variables[lon_name][1] - data.variables[lon_name][0]),
        'dy': float(data.variables[lat_name][1] - data.variables[lat_name][0]),
        'values': variable[timestep][:lat_select_index, :lon_select_index].reshape(variable[timestep][:lat_select_index, :lon_select_index].size).tolist()
    }

    return contour_data

client = GirderClient(host, port)
client.token = token

# Get the user
user = client.get('user/me')
# Get the dataset folder
parameters = {
    'userId': user['_id']
}
dataset_folder = client.get('minerva_dataset/folder', parameters=parameters)['folder']
dataset_folder_id = dataset_folder['_id']
parameters = {
    'id': fileId,
    'type': 'file'
}

# Get the file resource so we can get the name
开发者ID:essamjoubori,项目名称:minerva,代码行数:33,代码来源:contour.py


注:本文中的girder_client.GirderClient.token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。