Skip to content

Monitoring

Functions

register_file_monitor

1
2
3
4
5
register_file_monitor(
    filename: str,  # (1)!
    target: Strint | Signal = None,  # (2)!
    checker: TaskChecker | None = None,  # (3)!
)
  1. File or a directory to watch for its modification.

  2. Existing signal to raise or Signal Target to register signal implicitly.

    Available signal targets:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    * ``workers``  - run the signal handler on all the workers
    * ``workerN`` - run the signal handler only on worker N
    * ``worker``/``worker0`` - run the signal handler on the first available worker
    * ``active-workers`` - run the signal handlers on all the active [non-cheaped] workers
    
    * ``mules`` - run the signal handler on all mules
    * ``muleN`` - run the signal handler on mule N
    * ``mule``/``mule0`` - run the signal handler on the first available mule
    
    * ``spooler`` - run the signal on the first available spooler
    * ``farmN/farm_XXX``  - run the signal handler in the mule farm N or named XXX
    
  3. TaskChecker to be used for task execution requirements checking.

Maps a specific file/directory modification event to a signal.

ValueError If unable to register monitor.


Classes

Metric

Metric(name: str)

User metric related stuff.

Note

One needs to register user metric beforehand. E.g.:: section.monitoring.register_metric(section.monitoring.metric_types.absolute('mymetric'))


value

.value()

Current metric value.


decr

.decr(delta: int = 1) -> bool

Decrements the specified metric key value by the specified value.


div

.div(value: int = 1) -> bool

Divides the specified metric key value by the specified value.


incr

.incr(delta: int = 1) -> bool

Increments the specified metric key value by the specified value.


mul

.mul(value: int = 1) -> bool

Multiplies the specified metric key value by the specified value.


set

1
2
3
4
.set(
    value: int,  # (1)!
    mode: str | None = None,  # (2)!
) -> bool
  1. New value.

  2. Update mode.

    1
    2
    3
    * None - Unconditional update.
    * max - Sets metric value if it is greater that the current one.
    * min - Sets metric value if it is less that the current one.
    

Sets metric value.