arvados
Arvados Python SDK
This module provides the entire Python SDK for Arvados. The most useful modules include:
arvados.api - This module provides the
arvados.api.api
function to construct an Arvados REST API client, as well as other classes and functions that support it. You can call thearvados.api
module just like a function as a shortcut for callingarvados.api.api
.arvados.api_resources - The methods on an Arvados REST API client are generated dynamically at runtime. This module documents those methods and return values for the current version of Arvados. This module does not implement anything so you don’t need to import it, but it’s a helpful reference to understand how to use the Arvados REST API client.
arvados.collection - The
arvados.collection.Collection
class provides a high-level interface to read and write collections. It coordinates sending data to and from Keep, and synchronizing updates with the collection object.arvados.util - Utility functions to use mostly in conjunction with the API client object and the results it returns.
Other submodules provide lower-level functionality.
1# Copyright (C) The Arvados Authors. All rights reserved. 2# 3# SPDX-License-Identifier: Apache-2.0 4"""Arvados Python SDK 5 6This module provides the entire Python SDK for Arvados. The most useful modules 7include: 8 9* arvados.api - This module provides the `arvados.api.api` function to 10 construct an Arvados REST API client, as well as other classes and functions 11 that support it. You can call the `arvados.api` module just like a function 12 as a shortcut for calling `arvados.api.api`. 13 14* arvados.api_resources - The methods on an Arvados REST API client are 15 generated dynamically at runtime. This module documents those methods and 16 return values for the current version of Arvados. This module does not 17 implement anything so you don't need to import it, but it's a helpful 18 reference to understand how to use the Arvados REST API client. 19 20* arvados.collection - The `arvados.collection.Collection` class provides a 21 high-level interface to read and write collections. It coordinates sending 22 data to and from Keep, and synchronizing updates with the collection object. 23 24* arvados.util - Utility functions to use mostly in conjunction with the API 25 client object and the results it returns. 26 27Other submodules provide lower-level functionality. 28""" 29 30import logging as stdliblog 31import os 32import sys 33import types 34 35from collections import UserDict 36 37from . import api, errors, util 38from .api import api_from_config, http_cache 39from .collection import CollectionReader 40from arvados.keep import * 41from .logging import log_format, log_date_format, log_handler 42from .retry import RetryLoop 43 44# Backwards compatibility shims: these modules used to get pulled in after 45# `import arvados` with previous versions of the SDK. We must keep the names 46# accessible even though there's no longer any functional need for them. 47from . import cache 48from . import safeapi 49 50# Previous versions of the PySDK used to say `from .api import api`. This 51# made it convenient to call the API client constructor, but difficult to 52# access the rest of the `arvados.api` module. The magic below fixes that 53# bug while retaining backwards compatibility: `arvados.api` is now the 54# module and you can import it normally, but we make that module callable so 55# all the existing code that says `arvados.api('v1', ...)` still works. 56class _CallableAPIModule(api.__class__): 57 __call__ = staticmethod(api.api) 58api.__class__ = _CallableAPIModule 59 60# Override logging module pulled in via `from ... import *` 61# so users can `import arvados.logging`. 62logging = sys.modules['arvados.logging'] 63 64# Set up Arvados logging based on the user's configuration. 65# All Arvados code should log under the arvados hierarchy. 66logger = stdliblog.getLogger('arvados') 67logger.addHandler(log_handler) 68logger.setLevel(stdliblog.DEBUG if config.get('ARVADOS_DEBUG') 69 else stdliblog.WARNING)