pyslk.group_files_by_tape_raw

pyslk.group_files_by_tape_raw#

pyslk.group_files_by_tape_raw(resources: str | list | Path | None = None, search_id: int | str | None = None, search_query: str | None = None, recursive: bool = False, print_tape_id: bool = False, print_tape_barcode: bool = False, print_tape_status: bool = False, print_resource_id: bool = False, count_files: bool = False, gen_search_query: bool = False, run_search_query: bool = False, set_max_tape_number_per_search: int = -1, json: bool = False, full: bool = False, details: bool = False, count_tapes: bool = False, return_type: int = 0) str | int | CompletedProcess | Popen#

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

Receives a list of files or a search id as input. Looks up which files are stored in the HSM-Cache and which are not stored in the HSM-Cache but only on tape. Files on tape are grouped by tape: each line of the output contains all files which are on one tape. The user can directly create a search query for retrieving all files from one tape (–gen-search-query) or directly run this search (–run-search-query). In the latter case, the search id is printed per tape. If the user wants to know the tape id and the tape status, she/he might use –print-tape-id and –print-tape-status, respectively.

Parameters:
  • resources (str or list or Path-like or None) – list of resources to be searched for

  • search_id (int or str or None) – id of a search

  • search_query (str) – a search query

  • recursive (bool) – do recursive search in the namespaces

  • print_tape_id (bool) – print the tape id on the far left followed by a ‘:’, Default: False

  • print_tape_barcode (bool) – print the tape barcode on the far left followed by a ‘:’, Default: False

  • print_tape_status (bool) – print the status (‘avail’ or ‘blocked’) of the tape of each file group; if print_tape_id is set, this is printed: ‘TAPE_ID, TAPE_STATUS: FILES’; if this is not set, this is printed: TAPE_STATUS: FILES, Default: False

  • print_resource_id (bool) – print the resource id for each file instead of its path. Is ignored when ‘–gen-search-query’, ‘–run-search-query’, ‘–full’ or ‘–count-files’ are set. Default: False.

  • count_files (bool) – count files instead of printing file list

  • gen_search_query (bool) – generate and print (a) search query strings instead of the lists of files per tape, Default: False

  • run_search_query (bool) – generate and run (a) search query strings instead of the lists of files per tape and print the search i, Default: False

  • set_max_tape_number_per_search (int) – number of tapes per search; if ‘-1’ => the parameter is not set

  • json (bool) – return the output as JSON

  • full (bool) – print useful information and run search query per tape; implies print_tape_barcode, print_tape_status and run_search_query

  • details (bool) – print useful information; implies print_tape_barcode and print_tape_status

  • count_tapes (bool) – only count the number of involved tapes and print the number incl. some text

  • return_type (int) – select between 0 (== str output), 1 (== exit code), 2 (subprocess output), 3 (running subproc.)

Returns:

stdout of the slk_helpers call

Return type:

Union[str, int, subprocess.CompletedProcess, subprocess.Popen]