ReadWriteTest Class:

The ReadWriteTest class inherits from BaseTest class, and contains the main methods to create and run the test commands.

class ReadWriteTest( configFile=None, createFiles=False, root=True, https=True, davs=True )

A configuration file can be passed upon instantiation of the subclasses containing the endpoint, file path and optional port.

Optionally, specifying a directory, file name(s) and file size(s) in the config file and instantiating with createFiles=True will generate these files in the provided directory.

To exclude up to two of the protocols from being used, they can be toggled to False when instantiating the subclass

 

ReadWriteTest Methods:


method genScenarios( action, sourcePath=None, destinBaseNm=None, xrdArgs=None, gfalArgs=None, timeout=None, XROOTD_ECHO=False, INT_MANAGER=False, **readvArgs )

This method generates and runs commands for a given functionality, for each protocol and endpoint combination

     Parameters:

  • action (string) – Functionality of the command. Expects a string of one of the following:
    • copy – copy a single file
    • checksum – get checksum of one or more destination files
    • delete – delete a single destination file
    • readv – vector read on source and destination file
    • load – batch transfer multiple files to destination (Commands are run synchronously)
    • bulk-copy – transfer multiple files to destination (Commands are run asynchronously)
    • bulk-delete – delete multiple destination files
  • sourcePath (string, list) – Path to local file. Can be list when action = readv, load or bulk-copy
  • destinBaseNm (string, list) – Base name of file on endpoint. Can be list when action = checksum, readv or bulk-delete
  • xrdArgs (string, optional) – Extra flag(s) to be added to the generated base command of the action, for XRootD commands
  • gfalArgs (string, optional) - Extra flag(s) to be added to the generated base command of the action, for gfal2 commands
  • timeout (int, optional) – Optional timeout for all commands, overrides default (5 seconds)
  • XROOTD_ECHO (bool, optional) – Sets endpoint to redirector: xrootd.echo.stfc.ac.uk
  • INT_MANAGER (bool, optional) – Sets endpoint to redirector: echo-internal-manager01.gridpp.rl.ac.uk
  • **readvArgs (list, optional) – A vector list in format [(0, 100), .. (0, 100)]

     Returns:
         Returns a dictionary containing the command outputs required by the given action.
         All actions will return a dictionary containing the following key:value pairs:

  • 'cmdOuts': [(returncode, stdout, stderr), … (returncode, stdout, stderr)] – Returncode, stdout and stderr in a tuple for each command that was run
  • ‘IDs’: [‘example_ID1’, … ‘example_IDx’] – ID for each command/scenario in the format ‘protocol:endpoint-file’

         Additionally, the following actions will also contain extra key:value outputs:

         Copy and bulk-copy:

  • ‘srcsums’: [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each local file. When multiple files are passed, the ‘srcsums’ and ‘cmdOuts’ for each file is grouped into a tuple.

         Checksum:

  • ‘cmdOuts’: [(stderr1, stderr2), … (stderr1, stderr2)] – Standard error (without returncode and stdout) for each command that was run. Grouped into tuples if multiple files are passed to destinBaseNm.
  • ‘destsums’ = [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each destination file. Grouped into tuples if multiple files are passed to destinBaseNm.

         Readv:

  • ‘cmdOuts’: [(returncode, [destChunk], stderr), … (returncode, destChunk, stderr)] – Returncode, destChunk (a.k.a stdout) and stderr in a tuple for each command that was run.
  • ‘srcChunks’ = [[srcChunk], … [srcChunk]] – Chunks for local file for each command that was run

         Load:

  • ‘srcsums’ = [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each local file. Grouped into tuples if multiple files are passed to sourcePath.
  • ‘redirects’ = [(‘site1’, ‘site2’), … (‘site1’, ‘site2’)] – Sites that were redirected to, populated if redirectors XROOTD_ECHO=True or INT_MANAGER=True

     Return type:
        dictionary


method genTimedScenarios( action, sourcePath=None, destinBaseNm=None, xrdArgs=None, gfalArgs=None, reps=3, timeout=None, XROOTD_ECHO=False, INT_MANAGER=False, **readvArgs )

This method generates and runs commands for a given functionality, for each protocol and endpoint combination.
Each command is run for several repetitions (reps) and timed. An average of this time is returned with the output.

     Parameters:

  • action (string) – Functionality of the command. Expects a string of one of the following:
    • copy – copy a single file
    • checksum – get checksum of one or more destination files
    • delete – delete a single destination file
    • readv – vector read on source and destination file
    • load – batch transfer multiple files to destination (Commands are run synchronously)
    • bulk-copy – transfer multiple files to destination (Commands are run asynchronously)
    • bulk-delete – delete multiple destination files
  • sourcePath (string, list) – Path to local file. Can be list when action = readv, load or bulk-copy
  • destinBaseNm (string, list) – Base name of file on endpoint. Can be list when action = checksum, readv or bulk-delete
  • xrdArgs (string, optional) – Extra flag(s) to be added to the generated base command of the action, for XRootD commands
  • gfalArgs (string, optional) - Extra flag(s) to be added to the generated base command of the action, for gfal2 commands
  • reps (int, optional) – Set number of repetitions for each command to run, overrides default (3)
  • timeout (int, optional) – Optional timeout for all commands, overrides default (5 seconds)
  • XROOTD_ECHO (bool, optional) – Sets endpoint to redirector: xrootd.echo.stfc.ac.uk
  • INT_MANAGER (bool, optional) – Sets endpoint to redirector: echo-internal-manager01.gridpp.rl.ac.uk
  • **readvArgs (list, optional) – A vector list in format [(0, 100), .. (0, 100)]

     Returns:
         Returns a dictionary containing the command outputs required by the given action.
         All actions will return a dictionary containing the following key:value pairs:

  • ‘cmdOuts’: [(returncode, stdout, stderr, avgTime), … (returncode, stdout, stderr, avgTime)] – Returncode, stdout, stderr and avgTime in a tuple for each command that was run
  • ‘IDs’: [‘example_ID1’, … ‘example_IDx’] – ID for each command/scenario in the format ‘protocol:endpoint-file’

         Additionally, the following actions will also contain extra key:value outputs:

         Copy and bulk-copy:

  • ‘srcsums’: [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each local file. When multiple files are passed, the ‘srcsums’ and ‘cmdOuts’ for each file is grouped into a tuple.

         Checksum:

  • ‘cmdOuts’: [(file1-stderr, file2-stderr), … (file1-stderr, file2-stderr)] – Standard error (without returncode and stdout) for each command that was run. Grouped into tuples if multiple files are passed to destinBaseNm.
  • ‘destsums’: [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each destination file. Grouped into tuples if multiple files are passed to destinBaseNm.

         Readv:

  • ‘cmdOuts’: [(returncode, [destChunk], stderr, avgTime), … (returncode, destChunk, stderr), avgTime] – Returncode, destChunk (a.k.a stdout), stderr and avgTime in a tuple for each command that was run.
  • ‘srcChunks’ = [[srcChunk], … [srcChunk]] – Chunks for local file for each command that was run

         Load:

  • ‘srcsums’: [(file1-checksum, file2-checksum), … (file1-checksum, file2-checksum)] – Checksum for each local file. Grouped into tuples if multiple files are passed to sourcePath.
  • ‘redirects’: [(‘site1’, ‘site2’), … (‘site1’, ‘site2’)] – Sites that were redirected to, populated if redirectors XROOTD_ECHO=True or INT_MANAGER=True

     Return type:
        dictionary