duck.processesยถ

Module for retrieving or saving all processes created by Duck.

Attributes:

  • set_main_pid: Saves the main application process ID in json file.

Notes:

  • When opening a file, an exclusive lock is acquired to avoid race conditions.

Process JSON Format:

{
        "process-name": {
            "id": "xxx",
            "other-data": "xxx"
    },
        "another-process": {
            "id": "xxx",
        }
}

Module Contentsยถ

Functionsยถ

clear_processes_data

Clears all processes data in json file.

delete_process_data

Deletes the process data in json file.

get_all_processes_data

Returns all processes data saved in json file.

get_process_data

Retrieves the process data from json file.

set_process_data

Saves the process data in json file.

Dataยถ

BASE_DIR

FILENAME

APIยถ

duck.processes.BASE_DIRยถ

โ€˜rstrip(โ€ฆ)โ€™

duck.processes.FILENAMEยถ

โ€˜.processes.jsonโ€™

duck.processes.clear_processes_data()ยถ

Clears all processes data in json file.

duck.processes.delete_process_data(name: str) โ†’ dictยถ

Deletes the process data in json file.

Returns:

The deleted process data

Return type:

dict

duck.processes.get_all_processes_data() โ†’ dictยถ

Returns all processes data saved in json file.

duck.processes.get_process_data(name) โ†’ dictยถ

Retrieves the process data from json file.

duck.processes.set_process_data(name: str, data: dict, clear_existing_data=False) โ†’ strยถ

Saves the process data in json file.

Returns:

The json file in which the process data was saved.

Return type:

str