flux.job.validator.validator module

class flux.job.validator.validator.JobValidator(argv, pluginpath=None, parser=None)

Bases: object

A plugin-based job validator class

JobValidator loads plugins that implement the ValidatorPlugin interface from the 'flux.job.validator.plugins' namespace. Plugins may be configured at runtime by passing in a --plugins=LIST option

default_validators = ['jobspec']
plugin_namespace = 'flux.job.validator.plugins'
start()

Select and configure plugins, start executor, etc.

stop()

Stop the validator.

validate(jobinfo)

Validate jobinfo using all loaded validators

Parameters

jobinfo (ValidatorJobInfo) -- A ValidatorJobInfo object which describes the job to be validated.

Returns

ValidatorResult

If any one validator plugin fails, then result will indicate failure.

class flux.job.validator.validator.ValidatorJobInfo(jobinfo)

Bases: object

An instance of a Flux job specification used by job validators

jobspec

Submitted jobspec in Python dict form

Type

dict

userid

Submitting user id

Type

int

flags

Job flags supplied during submission

Type

int

urgency

Job urgency

Type

int

class flux.job.validator.validator.ValidatorPlugin(parser)

Bases: ABC

Base class for Validator Plugins

flux

on-demand per-plugin (per-thread) Flux handle.

Type

flux.Flux

configure(args)

Configure a ValidatorPlugin. Run after argparse.parse_args()

Parameters
  • args (Namespace) -- The resulting Namespace after calling

  • argparse.parse_args() --

property flux
abstract validate(job)

Validate a job. A ValidatorPlugin must implement this method

If a job fails validation, this method should either throw an exception, which will be caught by the calling script, or a (errnum, errmsg) tuple may optionally be returned, if that is more convenient.

On success, this method should return nothing or explicitly:

(0, None)
Parameters

job (ValidatorJobInfo) -- the job to validate

Returns

None or (errnum, errmsg) tuple.

class flux.job.validator.validator.ValidatorResult

Bases: object

Container for result or results from the JobValidator validate method

property errmsg

comma-separated string list of all error messages

Type

str

push_result(errnum, errmsg=None)

Add a result from one validator to a ValidatorResult

Parameters
  • errnum (int) -- error number (0 for success)

  • errmsg (str, optional) -- An optional error message for a failed result.

property success

True if job validated successfully, False otherwise

Type

bool