File: Meter.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 (101 lines) | stat: -rw-r--r-- 2,502 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ecflow.Meter
////////////


.. py:class:: Meter
   :module: ecflow

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

:term:`meter`\ s can be used to indicate proportional completion of :term:`task`

They are able to :term:`trigger` another job, which is waiting on this proportion.
Can also be used to indicate progress of a job. Meters can be used in
:term:`trigger` and :term:`complete expression`.

Constructor::

   Meter(name,min,max,<optional>color_change)
      string name                : The meter name
      int min                    : The minimum and initial meter value
      int max                    : The maximum meter value. Must be greater than min value.
      int color_change<optional> : default = max, Must be between min-max, used in the GUI

Exceptions:

- raises IndexError when an invalid Meter is specified

Usage:

Using a meter requires:

- Defining a meter on a :term:`task`:

.. code-block:: python

     meter = Meter('progress',0,100,100)
     task.add_meter(meter)

- Updating the corresponding :term:`ecf script` file with the meter :term:`child command`:

.. code-block:: shell

     ecflow_client --init=$$
     for i in 10 20 30 40 50 60 80 100; do
         ecflow_client --meter=progress $i
         sleep 2 # or do some work
     done
     ecflow_client --complete

- Optionally addition in a :term:`trigger` or :term:`complete expression` for job control:

  .. code-block:: shell

     trigger task:progress ge 60

  trigger and complete expression should *avoid* using equality i.e.:

  .. code-block:: shell

     trigger task:progress == 60

  Due to network issues the meter event's may **not** arrive in sequential order
  hence the :term:`ecflow_server` will ignore meter value's, which are less than the current value
  as a result triggers's which use meter equality may never evaluate


.. py:method:: Meter.color_change( (Meter)arg1) -> int :
   :module: ecflow

returns the color change


.. py:method:: Meter.empty( (Meter)arg1) -> bool :
   :module: ecflow

Return true if the Meter is empty. Used when returning a NULL Meter, from a find


.. py:method:: Meter.max( (Meter)arg1) -> int :
   :module: ecflow

Return the Meters maximum value


.. py:method:: Meter.min( (Meter)arg1) -> int :
   :module: ecflow

Return the Meters minimum value


.. py:method:: Meter.name( (Meter)arg1) -> str :
   :module: ecflow

Return the Meters name as string


.. py:method:: Meter.value( (Meter)arg1) -> int :
   :module: ecflow

Return meters current value