API reference#

This page provides an auto-generated summary of the pyslk API.

Wrapper Functions which return nice output#

Wrappers of slk and slk_helpers commands with improved output.

arch_size(path_or_id[, unit])

Get archive size from search id or GNS path by recursively listing all files of archive and adding file sizes

checksum(resource[, checksum_type])

Get a checksum of a resource

chgrp(gns_path, group[, recursive])

Change the group of a resource or namespace

chmod(gns_path, mode[, recursive])

Change the access mode of a resource or namespace

chown(gns_path, owner[, recursive])

Change the owner of a resource or namespace

cli_versions([cli])

Return the version of slk and/or slk_helpers

construct_dst_from_src(src, dst_gns[, ...])

Construct destination paths for source resources when they were archived to given destination

count_tapes([resource_path, search_id, ...])

Count number of tapes onto which provided files are stored; distinguishes between multi-tape and single-tape files

delete(gns_path[, recursive])

Soft delete a namespace (optionally all child objects of a non-empty

expiration_date()

Shows expiration date of your token

gen_file_query(resources[, recursive, ...])

Generates a search query that searches for the listed resources

gen_search_query(key_value_pairs[, ...])

Generates a search query that searches for the listed resources

get_job_status(job_id)

Check the status of a job

get_metadata(resource[, print_hidden, ...])

Get metadata

get_resource_id(resource_path)

returns resource_id to a resource path

get_resource_path(resource_id)

Get path for a resource id

get_resource_permissions([resource, ...])

Get path for a resource id

get_resource_size(resource[, recursive])

Returns file size in byte

get_resource_type(resource)

Get type of a resource

get_tag(path_or_id[, recursive])

Apply metadata to the namespace and child resources

get_tape_barcode(tape_id)

return tape barcode for provided tape id

get_tape_id(tape_barcode)

return tape id for provided tape barcode

group_files_by_tape([resource_path, ...])

Group files by tape id.

has_no_flag_partial([resource, search_id])

Check if whether file(s) is/are flagged as partial; return True/False

has_no_flag_partial_details([resource, ...])

Check if whether file(s) is/are flagged as partial; returns dict with keys 'flag_partial' and 'no_flag_partial'

hostname()

Shows current hostname you are connected to

hsm2json([resources, search_id, recursive, ...])

Extract metadata from HSM file(s) and return them in JSON structure

hsm2json_dict([resources, search_id, ...])

Extract metadata from HSM file(s) and return them in JSON structure

hsm2json_file(outfile[, resources, ...])

Extract metadata from HSM file(s) and return them in JSON structure

is_cached([resource, search_id])

Check if whether file(s) is/are in HSM cache or not; returns True/False

is_cached_details([resource, search_id])

Check if whether file(s) is/are in HSM cache or not; returns dict with keys 'cached' and 'not_cached'

is_file([resource])

Returns True if resource is a file

is_job_finished(job_id)

Check the status of a tape

is_job_processing(job_id)

Check the status of a tape

is_job_queued(job_id)

Check the status of a tape

is_job_successful(job_id)

Check the status of a tape

is_namespace([resource])

Returns True if resource is a namespace

is_on_tape([resource, search_id])

Check if whether file(s) is/are stored on tape; returns True/False

is_on_tape_details([resource, search_id])

Check if whether file(s) is/are stored on tape or not; returns dict with keys 'on_tape' and 'not_on_tape'

is_tape_available(tape)

Check if tape is available

job_exists(job_id)

Check if job exists

job_queue()

Prints status of the queue of tape read jobs

json_dict2hsm(json_dict[, restart_file, ...])

Read metadata from JSON dictionary and write them to archived files into HSM.

json_file2hsm(json_file[, restart_file, ...])

Read metadata from JSON file and write them to archived files into HSM.

json_str2hsm(json_string[, restart_file, ...])

Read metadata from JSON file and write them to archived files into HSM.

json2hsm([json_file, restart_file, schema, ...])

Read metadata from JSON file and write them to archived files into HSM.

list(path_or_id[, show_hidden, numeric_ids, ...])

Return pandas.DataFrame containing results from search id or GNS path

makedirs(gns_path[, exist_ok])

Create a directory like 'mkdir()' but create parent directories recursively, if they do not exist

mkdir(gns_path)

Create a directory

move(src_path, dst_gns, no_overwrite)

Move namespaces/files from one parent folder to another; renaming is not possible

rename(old_name, new_name)

Rename a folder or file; moving is not possible

resource_exists(resource)

Check if resource exists and return True/False

search(search_string)

Performs a search based on a search_string can be provided.

searchid_exists(search_id)

Get path for a resource id

session()

Shows expiration date of your token

set_tag(path_or_id, metadata[, recursive])

Apply metadata to the namespace and child resources

size([resource])

Returns file size in byte

tape_exists(tape)

Check if tape exists

tape_status(tape[, details])

Check the status of a tape

total_number_search_results(search_id)

Print the total number of search results regardless of read permissions of the current user

valid_session()

Returns whether session token is valid or not

valid_token()

Returns whether session token is valid or not

version_slk()

List the version of slk

version_slk_helpers()

List the version of slk_helpers

Config#

Adjust and query slk config.

config.get(key[, default])

Get global slk config.

config.set(**kwargs)

Set pyslk configuration to intract with the slk backend.

Basic wrappers without proper parsing of the output#

Basic wrappers for slk and slk_helpers commands.

archive_raw(src_path, dst_gns[, partsize, ...])

Upload files in a directory and optionally tag resources

checksum_raw(resource_path[, checksum_type, ...])

Get a checksum of a resource

chmod_raw(gns_path, mode[, recursive, ...])

Change the access mode of a resource or namespace

delete_raw(gns_path[, recursive, return_type])

Soft delete a namespace (optionally all child objects of a non-empty

exists_raw(gns_path[, return_type])

Check if resource exists

gen_file_query_raw(resources[, recursive, ...])

Generates a search query that searches for the listed resources

gen_search_query_raw(key_value_pairs[, ...])

Generates a search query that searches based on the conditions provided as key-values pairs

group_files_by_tape_raw([resources, ...])

groups a list of files based on which tape they are stored on

group_raw(gns_path, group[, recursive, ...])

Change the group of a resource or namespace

has_no_flag_partial_raw([resource_path, ...])

Get info whether file is flagged as partial file

hostname_raw([return_type])

Shows current hostname you are connected to

hsm2json_raw([resources, search_id, ...])

Extract metadata from HSM file(s) and return them in JSON structure

iscached_raw([resource_path, resource_id, ...])

Get info whether file is in HSM cache or not

is_on_tape_raw([resource_path, resource_id, ...])

Get info whether file is stored on a tape or not (independent on whether it is stored in the cache)

job_status_raw(job_id[, return_type])

Check the status of a tape read job with the given ID

job_exists_raw(job_id[, return_type])

Check if tape read job exists

job_queue_raw([interpret, return_type])

Prints status of the queue of tape read jobs

json2hsm_raw([json_file, restart_file, ...])

Read metadata from JSON file and write them to archived files into HSM.

list_raw(path_or_id[, show_hidden, ...])

List results from search id or GNS path

list_search_raw(search_id[, only_files, ...])

List results from search id

metadata_raw(resource_path[, ...])

Get metadata

mkdir_raw(gns_path[, recursive, parents, ...])

Create a directory

move_raw(src_path, dst_gns, interactive[, ...])

Move namespaces/files from one parent folder to another; renaming is not possible

owner_raw(gns_path, owner[, recursive, ...])

Change the owner of a resource or namespace

recall_raw(path_or_id[, recursive, return_type])

Recall files from tape to cache via search id or GNS path

rename_raw(old_name, new_name[, return_type])

Rename a folder or file; moving is not possible

resource_path_raw(resource_id[, return_type])

Get path for a resource id

resource_permissions_raw([resource_path, ...])

Get permissions of a resource provided via resource id or a resource path

resource_type_raw([resource_path, ...])

Get type of resource provided via resource id or a resource path

resourcepath_raw(resource_id[, return_type])

Get path for a resource id

retrieve_raw(path_or_id, dest_dir[, ...])

Retrieve files via search id or GNS path.

searchid_exists_raw(search_id[, return_type])

Check if search id exists

search_limited_raw(search_string[, return_type])

Performs a search based on a search_string can be provided.

search_raw([search_string, group, user, ...])

Creates search and returns search id

session_raw([return_type])

Shows expiration date of your token

size_raw([resource_path, resource_id, ...])

Returns file size in byte

tag_raw(path_or_id[, metadata, recursive, ...])

Apply metadata to the namespace and child resources

tape_barcode_raw(tape_id[, return_type])

return tape barcode for provided tape id

tape_id_raw(tape_barcode[, return_type])

return tape id for provided tape barcode

tape_status_raw([tape_id, tape_barcode, ...])

Check the status of a tape

tape_exists_raw([tape_id, tape_barcode, ...])

Check if tape exists

total_number_search_results_raw(search_id[, ...])

Print the total number of search results regardless of read permissions of the current user

version_slk_raw([return_type])

List the version of slk

version_slk_helpers_raw([return_type])

List the version of slk_helpers

Functions soon to be deprecated#

Please use the corresponding functions without the slk prefix.

exists(gns_path)

Check if resource exists and return True/False

list_search(search_id[, only_files, ...])

Return pandas.DataFrame containing results from search id

search_limited(search_string)

Performs a search based on a search_string can be provided.