daemon.py
exec_and_write(func, func_args, output_file, fetch_conf)
Execute a given function with the given args and write the output to the given file preventing collisions with a lock.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
callable |
Function to execute. |
required |
func_args |
list |
Arguments to pass to the executed function. |
required |
output_file |
str |
Path to the file were to append the results. |
required |
fetch_conf |
dict |
Configuration parameters for fetching the content. |
required |
Source code in crtm_poll/daemon/daemon.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
start_daemon(func, func_args, output_file, interval=60, processes=5, max_conn_test=None, fetch_conf={})
Start a daemon that infinitely spawns a given function asynchronously every interval and writes the output to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
callable |
Function to execute. |
required |
func_args |
list |
Arguments to pass to the executed function. |
required |
output_file |
str |
Path to the file were to append the results. |
required |
interval |
int |
Number of seconds between spawns (the spawning period). |
60 |
processes |
int |
Maximum number of simultaneously running spawned processes. |
5 |
max_conn_test |
list |
Test different maximum (simultaneous) connections
in random order. Pass 4 integer values: start, stop, step and
repetition (e.g. |
None |
fetch_conf |
dict |
Configuration parameters for fetching the content. |
{} |
Source code in crtm_poll/daemon/daemon.py
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 |
|