FCConditionParser

Contains the mechanism to evaluate whether to use or not a catalog

class DIRAC.Resources.Catalog.FCConditionParser.FCConditionParser(vo=None, ro_methods=None)

Bases: object

This objects allows to evaluate conditions on whether or not a given operation should be evaluated on a given catalog for a given lfn (be glad so many things are given to you !).

The conditions are expressed as boolean logic, where the basic bloc has the form “pluginName=whateverThatWillBePassedToThePlugin”. The basic blocs will be evaluated by the respective plugins, and the result can be combined using the standard boolean operators:

* `!` for not
* `&` for and
* `|` for or
* `[ ]` for prioritizing the operations

All these characters, as well as the ‘=’ symbol cannot be used in any expression to be evaluated by a plugin.

The rule to evaluate can either be given at calling time, or can be retrieved from the CS depending on the context (see doc of __call__ and __getConditionFromCS)

Example of rules are:

* Filename=startswith('/lhcb') & Proxy=voms.has(/lhcb/Role->production)
* [Filename=startswith('/lhcb') & !Filename=find('/user/')] | Proxy=group.in(lhcb_mc, lhcb_data)
class PluginOperand(tokens)

Bases: object

This class is a wrapper for a plugin and it’s condition It is instantiated by pyparsing every time it encounters “plugin=condition”

__init__(tokens)
Parameters:

tokens – [ pluginName, =, conditions ] the pluginName is automatically prepended with ‘Plugin’

eval(**kwargs)

Forward the evaluation call to the plugin

Parameters:

kwargs – contains all the information given to the plugin namely the lfns

Returns:

True or False

__init__(vo=None, ro_methods=None)
Parameters:

vo – name of the VO