Commit 22523a95 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[databases] Fixed line length

parent b194b0f1
......@@ -116,7 +116,7 @@ CMD_DB_INDEX = 'index'
CMD_VIEW_OUTPUTS = 'databases_provider'
#----------------------------------------------------------
# ----------------------------------------------------------
def load_database_sets(configuration, database_name):
......@@ -140,8 +140,8 @@ def load_database_sets(configuration, database_name):
else:
logger.error("Database specification should have the format "
"`<database>/<version>/[<protocol>/[<set>]]', the value you "
"passed (%s) is not valid", (dataset_name))
"`<database>/<version>/[<protocol>/[<set>]]', the value "
"you passed (%s) is not valid", (dataset_name))
return (None, None)
# Load the dataformat
......@@ -176,19 +176,21 @@ def load_database_sets(configuration, database_name):
if set_filter is not None:
if set_filter not in sets:
logger.error("The database/protocol `%s/%s' does not have the "
"set `%s' - choose one of `%s'", db_name, protocol_name,
set_filter, ', '.join(sets))
"set `%s' - choose one of `%s'",
db_name, protocol_name, set_filter,
', '.join(sets))
return (None, None, None)
sets = [z for z in sets if z == set_filter]
loaded_sets.extend([(protocol_name, set_name, database.set(protocol_name, set_name))
loaded_sets.extend([(protocol_name, set_name,
database.set(protocol_name, set_name))
for set_name in sets])
return (db_name, database, loaded_sets)
#----------------------------------------------------------
# ----------------------------------------------------------
def start_db_container(configuration, cmd, host,
......@@ -212,7 +214,7 @@ def start_db_container(configuration, cmd, host,
db_configuration['datasets_root_path'] = db_root
for output_name, dataformat_name in db_set['outputs'].items():
if (excluded_outputs is not None) and (output_name in excluded_outputs):
if excluded_outputs is not None and output_name in excluded_outputs:
continue
dataset_hash = hashDataset(db_name, protocol_name, set_name)
......@@ -306,7 +308,7 @@ def start_db_container(configuration, cmd, host,
db_socket.connect(db_address)
for output_name, dataformat_name in db_set['outputs'].items():
if (excluded_outputs is not None) and (output_name in excluded_outputs):
if excluded_outputs is not None and output_name in excluded_outputs:
continue
data_source = RemoteDataSource()
......@@ -322,7 +324,7 @@ def start_db_container(configuration, cmd, host,
return databases_container
#----------------------------------------------------------
# ----------------------------------------------------------
def pull(webapi, prefix, names, force, indentation, format_cache):
......@@ -333,21 +335,21 @@ def pull(webapi, prefix, names, force, indentation, format_cache):
webapi (object): An instance of our WebAPI class, prepared to access the
BEAT server of interest
prefix (str): A string representing the root of the path in which the user
objects are stored
prefix (str): A string representing the root of the path in which the
user objects are stored
names (list): A list of strings, each representing the unique relative path
of the objects to retrieve or a list of usernames from which to retrieve
objects. If the list is empty, then we pull all available objects of a
given type. If no user is set, then pull all public objects of a given
type.
names (list): A list of strings, each representing the unique relative
path of the objects to retrieve or a list of usernames from which to
retrieve objects. If the list is empty, then we pull all available
objects of a given type. If no user is set, then pull all public
objects of a given type.
force (bool): If set to ``True``, then overwrites local changes with the
remotely retrieved copies.
indentation (int): The indentation level, useful if this function is called
recursively while downloading different object types. This is normally
set to ``0`` (zero).
indentation (int): The indentation level, useful if this function is
called recursively while downloading different object types. This is
normally set to ``0`` (zero).
format_cache (dict): A dictionary containing all dataformats already
downloaded.
......@@ -355,8 +357,8 @@ def pull(webapi, prefix, names, force, indentation, format_cache):
Returns:
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
int: Indicating the exit status of the command, to be reported back to
the calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
"""
......@@ -364,7 +366,8 @@ def pull(webapi, prefix, names, force, indentation, format_cache):
from .dataformats import pull as dataformats_pull
status, names = common.pull(webapi, prefix, 'database', names,
['declaration', 'code', 'description'], force, indentation)
['declaration', 'code', 'description'],
force, indentation)
# see what dataformats one needs to pull
indent = indentation * ' '
......@@ -381,7 +384,7 @@ def pull(webapi, prefix, names, force, indentation, format_cache):
return status + df_status
#----------------------------------------------------------
# ----------------------------------------------------------
def index_outputs(configuration, names, uid=None, db_root=None, docker=False):
......@@ -417,7 +420,8 @@ def index_outputs(configuration, names, uid=None, db_root=None, docker=False):
else:
databases_container = \
start_db_container(configuration, CMD_DB_INDEX,
host, db_name, protocol_name, set_name, database, db_set,
host, db_name, protocol_name, set_name,
database, db_set,
uid=uid, db_root=db_root
)
status = host.wait(databases_container)
......@@ -427,7 +431,7 @@ def index_outputs(configuration, names, uid=None, db_root=None, docker=False):
return retcode
#----------------------------------------------------------
# ----------------------------------------------------------
def list_index_files(configuration, names):
......@@ -459,7 +463,7 @@ def list_index_files(configuration, names):
return retcode
#----------------------------------------------------------
# ----------------------------------------------------------
def delete_index_files(configuration, names):
......@@ -495,7 +499,7 @@ def delete_index_files(configuration, names):
return retcode
#----------------------------------------------------------
# ----------------------------------------------------------
def checksum_index_files(configuration, names):
......@@ -528,7 +532,7 @@ def checksum_index_files(configuration, names):
return retcode
#----------------------------------------------------------
# ----------------------------------------------------------
def view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None,
......@@ -643,7 +647,7 @@ def view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None,
return 0
#----------------------------------------------------------
# ----------------------------------------------------------
def process(args):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment