Skip to main content

basic back-end progress api for the data analytics software framework dasf

Project description

DASF Logo

Progress API for the Data Analytics Software Framework (DASF)

CI Latest Release PyPI version Code style: black Imports: isort PEP8 Checked with mypy REUSE status

DASF: Progress API is part of the Data Analytics Software Framework (DASF, https://codebase.helmholtz.cloud/dasf), developed at the GFZ German Research Centre for Geosciences (https://www.gfz-potsdam.de). It is funded by the Initiative and Networking Fund of the Helmholtz Association through the Digital Earth project (https://www.digitalearth-hgf.de/).

DASF: Progress API provides a light-weight tree-based structure to be sent via the DASF RCP messaging protocol. It's generic design supports deterministic as well as non-deterministic progress reports. While DASF: Messaging Python provides the necessary implementation to distribute the progress reports from the reporting backend modules, DASF: Web includes ready to use components to visualize the reported progress.

Installation

Install this package in a dedicated python environment via

python -m venv venv
source venv/bin/activate
pip install deprogessapi

To use this in a development setup, clone the source code from gitlab, start the development server and make your changes::

git clone https://codebase.helmholtz.cloud/dasf/dasf-progress-api
cd dasf-progress-api
python -m venv venv
source venv/bin/activate
make dev-install

More detailed installation instructions my be found in the docs.

Service Desk

For everyone without a Geomar Gitlab account, we setup the Service Desk feature for this repository. It lets you communicate with the developers via a repository specific eMail address. Each request will be tracked via the Gitlab issuse tracker.

eMail: gitlab+digital-earth-dasf-dasf-progress-api-2274-issue-@git-issues.geomar.de

Usage

A progress report is stored in a tree structure. So there will be one 'root' report instance containing multiple 'sub-reports'.

In order to report the progress simply add a reporter argument with type ProgressReport to the exposed method, e.g.

from deprogressapi import ProgressReport

def some_exposed_method(reporter: Optional[ProgressReport] = ProgressReport(
                          step_message="some progress message")) -> str:

    # ...

For a report instance new subreports can be created via the create_subreport method. Each created report is published (sent to the requesting client) automatically upon creation and on completion.

# create a subreport
sub_report = root_report.create_subreport(step_message="Calculating something")

# execute some logic
# ...

# mark the sub-report as compelte
sub_report.complete()

All sub-reports are again instances of ProgressReport, so you can create more sub-reports for each.

error handling

In order to report an error, you provide an error status argument to the complete method. The corresponding error message can be set via the reports step_message field.

from deprogressapi.base import Status

# ...
# some code that raises an exception
# ...
except Exception as e:
    error = str(e)
    progress_report.step_message = "error '{msg}': {err}".format(msg=progress_report.step_message, err=error)
    progress_report.complete(Status.ERROR)

Recommended Software Citation

Eggert, Daniel; Dransch, Doris (2021): DASF: Progress API: A progress reporting structure for the data analytics software framework. V. v0.1.4. GFZ Data Services. https://doi.org/10.5880/GFZ.1.4.2021.007

Technical note

This package has been generated from the template https://codebase.helmholtz.cloud/hcdc/software-templates/python-package-template.git.

See the template repository for instructions on how to update the skeleton for this package.

License information

Copyright © 2020-2024 Helmholtz Centre Potsdam GFZ German Research Centre for Geosciences

Code files in this repository are licensed under the Apache-2.0, if not stated otherwise in the file.

Documentation files in this repository are licensed under CC-BY-4.0, if not stated otherwise in the file.

Supplementary and configuration files in this repository are licensed under CC0-1.0, if not stated otherwise in the file.

Please check the header of the individual files for more detailed information.

License management

License management is handled with reuse. If you have any questions on this, please have a look into the contributing guide or contact the maintainers of dasf-progress-api.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deprogressapi-0.4.2.tar.gz (23.5 kB view hashes)

Uploaded Source

Built Distribution

deprogressapi-0.4.2-py3-none-any.whl (24.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page