Skip to content

Model classes

This page provides an overview over the model classes which are extracted from the parsed PFDL file. For an overview visit the architecture section.

pfdl_scheduler.model.array.Array(type_of_elements='', values=None, context=None)

Represents an Array in the PFDL.

Used as as an array definition or a returned array with elements in it.

Attributes:

Name Type Description
type_of_elements str

A string representing the type of the elements inside the array.

values List[Any]

A list of elements of the Array (empty if it is a array definition).

length int

An integer for the length of the Array. If it is not defined it gets the value -1.

context ParserRuleContext

ANTLR context object of this class.

Initialize the object.

Parameters:

Name Type Description Default
type_of_elements str

A string representing the type of the elements inside the array.

''
values List[Any]

A list of elements of the Array (empty if it is a array definition).

None
context ParserRuleContext

ANTLR context object of this class.

None

append_value(value)

Adds an element to the array and increase the length.

Parameters:

Name Type Description Default
value Any

The value that should be added to the array.

required

length_defined()

Returns whether the lenght of the array is defined.

Returns:

Type Description
bool

True if the length of the array is defined.

pfdl_scheduler.model.condition.Condition(expression=None, passed_stmts=None, failed_stmts=None, context=None) dataclass

Represents a conditional statement in the PFDL.

A Condition consists of a boolean expression which has to be satisfied in order to execute the statements in the Passed block. Otherwise the statements in the Failed block will be executed.

Attributes:

Name Type Description
expression Dict

Boolean expression in form of a dict (see Visitor for the dict structure).

passed_stmts List[Union[Service, TaskCall, Loop, Condition]]

List of statements which are executed when the expression is satisfied.

failed_stmts List[Union[Service, TaskCall, Loop, Condition]]

List of statements which are executed when the expression is not satisfied.

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
expression Dict

Boolean expression in form of a dict (see Visitor for the dict structure).

None
passed_stmts List[Union[Service, TaskCall, Loop, Condition]]

List of statements which are executed when the expression is satisfied.

None
failed_stmts List[Union[Service, TaskCall, Loop, Condition]]

List of statements which are executed when the expression is not satisfied.

None
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.counting_loop.CountingLoop(statements=None, counting_variable='', limit='', parallel=False, context=None) dataclass

Bases: Loop

Represents a Counting Loop in the PFDL.

Counting loops count a variable from an initial value to a given upper limit. If the parallel keyword was used, this loop executes the statements in the loop body in parallel as many times as the loop would iterate.

Attributes:

Name Type Description
statements

List of statements inside the loop body.

context

ANTLR context object of this class.

context_dict

Maps other attributes with ANTLR context objects.

counting_variable str

Name of the variable which is counted in the loop.

limit str

Integer for the upper limit.

parallel bool

A boolean indicating if the loop is a parallel loop or not.

Initialize the object.

Parameters:

Name Type Description Default
statements List[Union[Service, TaskCall, Loop, Condition]]

List of statements inside the loop body.

None
counting_variable str

Name of the variable which is counted in the loop.

''
limit str

Integer for the upper limit.

''
parallel bool

A boolean indicating if the loop is a parallel loop or not.

False
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.loop.Loop(statements=None, context=None) dataclass

The base class for the PFDL loops.

Attributes:

Name Type Description
statements List[Union[Service, TaskCall, Loop, Condition]]

List of statements inside the loop body.

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
statements List[Union[Service, TaskCall, Loop, Condition]]

List of statements inside the loop body.

None
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.parallel.Parallel(task_calls=None, context=None) dataclass

Represents a Parallel statement in the PFDL.

Each task within this instruction is executed in parallel with the calling task. When all parallel tasks are finished, the calling task continues its execution.

Attributes:

Name Type Description
task_calls List[TaskCall]

List of Task Calls in the Parallel statement.

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
task_calls List[TaskCall]

List of Task Calls in the Parallel statement.

None
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.process.Process(structs=None, tasks=None) dataclass

Represents a production process described in a PFDL file.

A Process consists of multiple Structs and Tasks. A Process object gets created after the visitor traverses the syntax tree.

Attributes:

Name Type Description
structs Dict[str, Struct]

A dict for mapping the Struct names to the Struct objects.

task Dict[str, Struct]

A dict for mapping the Task names to the Task objects.

Initialize the object.

Parameters:

Name Type Description Default
structs Dict[str, Struct]

A dict for mapping the Struct names to the Struct objects.

None
tasks Dict[str, Task]

A dict for mapping the Task names to the Task objects.

None

pfdl_scheduler.model.service.Service(name='', input_parameters=None, output_parameters=None, context=None) dataclass

Represents a Service or Service Call in the PFDL.

Represents a Service or Service Call in the langauge which can be mapped to a real service that can be executed.

Attributes:

Name Type Description
name str

A string representing the name of the Service.

input_parameters List[Union[str, List[str], Struct]]

List of input parameters of the Service.

output_parameters OrderedDict[str, Union[str, Array]]

List of output parameters of the Service.

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
name str

A string representing the name of the Service.

''
input_parameters List[Union[str, List[str], Struct]]

List of input parameters of the Service.

None
output_parameters Dict[str, Union[str, Array]]

List of output parameters of the Service.

None
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.struct.Struct(name='', attributes=None, context=None) dataclass

Represents a Struct in the PFDL.

Data container for Services and Taskcalls. Used both for Struct definitons and instantiated Structs.

Attributes:

Name Type Description
name str

A string representing the name of the Struct.

attributes Dict[str, Union[str, Array, Struct]]

A dict which maps the attribute names to the defined type or a value (if its a instantiated struct).

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
name str

A string representing the name of the Struct.

''
attributes Dict[str, Union[str, Array, Struct]]

A dict which maps the attribute names to the defined type or a value (if its a instantiated struct).

None
context ParserRuleContext

ANTLR context object of this class.

None

from_json(json_string, error_handler, struct_context) classmethod

Creates a Struct instance out of the given JSON string.

Parameters:

Name Type Description Default
json_string str

A JSON string desribing the Struct.

required
error_handler ErrorHandler

An ErrorHandler instance used for printing errors.

required

Returns:

Type Description
Struct

The Struct which was created from the JSON string.

pfdl_scheduler.model.task_call.TaskCall(name='', input_parameters=None, output_parameters=None, context=None) dataclass

Represents a TaskCall in the PFDL.

Provides information about the name and call parameters of a Task which is called within another Task.

Attributes:

Name Type Description
name str

A string representing the name of the TaskCall.

input_parameters List[Union[str, List[str], Struct]]

List of input parameters of the TaskCall.

output_parameters Dict[str, Union[str, Array]]

List of output parameters of the TaskCall.

context ParserRuleContext

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
name str

A string representing the name of the TaskCall.

''
input_parameters List[Union[str, List[str], Struct]]

List of input parameters of the TaskCall.

None
output_parameters Dict[str, Union[str, Array]]

List of output parameters of the TaskCall.

None
context ParserRuleContext

ANTLR context object of this class.

None

pfdl_scheduler.model.while_loop.WhileLoop(statements=None, expression=None, context=None) dataclass

Bases: Loop

Represents a While Loop in the PFDL.

Loops until conditional statement (expression) is satisfied.

Attributes:

Name Type Description
statements

List of statements inside the loop body.

expression Dict

Boolean expression in form of a dict.

context Dict

ANTLR context object of this class.

context_dict Dict

Maps other attributes with ANTLR context objects.

Initialize the object.

Parameters:

Name Type Description Default
statements List[Union[Service, TaskCall, Loop, Condition]]

List of statements inside the loop body.

None
expression Dict

Boolean expression in form of a dict.

None
context ParserRuleContext

ANTLR context object of this class.

None