File: PartExpression.rst

package info (click to toggle)
ecflow 5.15.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,868 kB
  • sloc: cpp: 269,341; python: 22,756; sh: 3,609; perl: 770; xml: 333; f90: 204; ansic: 141; makefile: 70
file content (62 lines) | stat: -rw-r--r-- 1,910 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ecflow.PartExpression
/////////////////////


.. py:class:: PartExpression
   :module: ecflow

   Bases: :py:class:`~Boost.Python.instance`

PartExpression holds part of a :term:`trigger` or :term:`complete expression`.

Expressions can contain references to :term:`event`\s, :term:`meter`\ s, user variables,
:term:`repeat` variables and generated variables. The part expression allows us
to split a large trigger or complete expression into smaller ones

Constructor::

  PartExpression(exp )
      string   exp: This represents the *first* expression

  PartExpression(exp, bool and_expr)
      string   exp: This represents the expression
      bool and_exp: If true the expression is to be anded, with a previously added expression
                    If false the expression is to be 'ored', with a previously added expression

Usage:
To add simple expression this class can be by-passed, i.e. can use:

.. code-block:: python

  task = Task('t1')
  task.add_trigger( 't2 == active' )
  task.add_complete( 't2 == complete' )

To add large triggers and complete expression:

.. code-block:: python

  exp1 = PartExpression('t1 == complete')
  # a simple expression can be added as a string
  ....
  task2.add_part_trigger( PartExpression('t1 == complete or t4 == complete') ) 
  task2.add_part_trigger( PartExpression('t5 == active',True) )    # anded with first expression
  task2.add_part_trigger( PartExpression('t7 == active',False) )   # or'ed with last expression added

The trigger for task2 is equivalent to
't1 == complete or t4 == complete and t5 == active or t7 == active'


.. py:method:: PartExpression.and_expr( (PartExpression)arg1) -> bool
   :module: ecflow


.. py:method:: PartExpression.get_expression( (PartExpression)arg1) -> str :
   :module: ecflow

returns the part expression as a string


.. py:method:: PartExpression.or_expr( (PartExpression)arg1) -> bool
   :module: ecflow