Skip to content

Worker Gfal interface

Alexander Richards edited this page Jul 12, 2018 · 14 revisions

Input

JSON object:

{
  "base": "protocol://some/base",
  "files": ["path/relative/to/base"],
  "dirs": [],
  "options": { "key": value }
}

In this way, a listing job would have a single entry in the files list, a remove job could have a list and copy jobs will have a list of tuples.

LIST job

{
  "files": ["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test"],
  "options": { "depth": 1,
               "checksum": "adler32" }
}

Where here it's understood that depth has the following meaning:

depth value Meaning
-1 infinite recursion
1 a single level (no recursion)
n n levels of recursion
0 a single level (same as depth 1)

REMOVE job

{
  "files": ["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/200mb-test-file-mice.bin",
            "gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/data_copy_500MB"
           ],
  "dirs": ["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test"],
  "options": { }
}

COPY job

{
  "files": [["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/200mb-test-file-mice.bin",
             "gsiftp://dc2-grid-64.brunel.ac.uk/dpm/brunel.ac.uk/home/mice/martynia/test/200mb-test-file-mice.bin"],
            ["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/data_copy_500MB",
             "gsiftp://dc2-grid-64.brunel.ac.uk/dpm/brunel.ac.uk/home/mice/martynia/test/data_copy_500MB"]
           ],
  "options": { "make_dirs": true,
               "checksum": "adler32",
               "encrypt": false,
               "preserve_timestamp": true }
}

RENAME job

{
  "files": [["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/200mb-test-file-mice.bin",
             "gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test/200mb-NEWtest-file-mice.bin"]],
  "options": { }
}

MKDIR job

{
  "dirs": ["gsiftp://gfe02.grid.hep.ph.ic.ac.uk/pnfs/hep.ph.ic.ac.uk/data/mice/martynia/test"],
  "options": { }
}

Output

Remove Job

The remove operation prints the following json string as it runs (so the message will be repeated for every file removed)

{"Reason": "OK", "Code": 0}
{"Reason": "OK", "Code": 0}

If for any reason the operation fails the Code value will be set to 1 and the Reason will hold an error message returned by the back-end.

Copy Job

The copy job output will have the same format as the remove operation output described above. In addition stderr stream will contain a monitor message in the form:

MONITOR src: gsiftp://dc2-grid-64.brunel.ac.uk/dpm/brunel.ac.uk/home/gridpp/gridpp/user/s/steve.lloyd/data_500MB [  11] 500.00MB (44137.00KB/s)

It starts with a keyword MONITOR followed by src: <source_file_path> [time elapsed] size (speed) .

List Job

List job output (json) is created from a dictionary of a form:

{directory_path:[{enhanced stat dict}], 
                 [{enhanced stat dict}], ...], 
 directory_path:[....], ..}

The "enhanced stat dict" is a stat dictionary with an additional 'name':file_or_dirname key:value pair. Outer dictionary keys are paths (for all levels, if depth is greater than 1), the value is a list of dictionaries, each containing file or directory names and stat information.

Clone this wiki locally