Policy Driver

Policy Driver is a driver script used as part of List Processing rules. It is not meant to be called directly.

The Policy Driver also provides a special AttrDict class, which holds the attributes for files selected by processing rules. These AttrDict classes are what the user-defined processing functions work on.

The file attributes included in the class are:

  • pathname (str)
  • poolname (str)
  • userid (int)
  • name (str)
  • changetime (datetime)
  • generation (int)
  • accesstime (datetime)
  • modificationsnapid (int)
  • creationtime (datetime)
  • blocksize (int)
  • nlink (int)
  • modificationtime (datetime)
  • miscattributes (str)
  • filesetname (str)
  • mode (str)
  • filesize (int)
  • rdeviceid (int)
  • groupid (int)
  • inode (int)
  • kballocated (int)
  • deviceid (int)

Attribute names are case-insensitive and any underscores are ignored.

Description

class arcapix.fs.gpfs.policydriver.AttrDict(*args, **kwargs)

This class is a modified dictionary, which holds a collection of attributes for a file.

The class allows you to reference file attributes as either dictionary keys or as object properties, i.e.

>>> x['filesize'] ==  x.filesize

The class also supports attribute aliases - in particular, case and underscores are ignored, e.g.

>>> x.FILE_NAME == x.filename
classmethod loads(s)

Create an AttrDict from a list-file string

i.e. strings from the files generated by GPFS LIST rules.

Attribute values are automatically converted to their appropriate type, e.g.

>>> type(x.filesize) == int
>>> type(x.creation_time) == datetime
arcapix.fs.gpfs.policydriver.run_processing_rule(list_, rule)

Execute ‘parallel’ processing for a rule with a given list file.

Parameters:
  • list – path to a list file, as generated by a policy
  • rule – a list processing rule

The policydriver script will dump the result of this function to file. The calling policy will then load this and any other parallel results, and combine them to produce the final result.