Skip to main content

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

Reason this release was yanked:

broken imports

Project description

Progress api for DASF modules based on python. Developed and tested with Python 3.8

Scope

This library is part of the Data Analytics Software Framework DASF (https://git.geomar.de/digital-earth/dasf), which was developed by the GFZ Potsdam (https://www.gfz-potsdam.de) in the Digital Earth project (https://www.digitalearth-hgf.de/).

Usage

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

The root report will be initialized directly. The contructor demands a send_handler argument, so we need to create one first. The dasf-messaging-python module provides a ready to use implementation for the send_handler via the ProgressSendHandler class. In order to instantiate the send handler you need to pass the PulsarMessageConsumer that is used to receive the request that is monitored, as well as the corresponding request message. You might add additional message properties via the msg_props dictionary.

from demessaging.progress_send_handler import ProgressSendHandler

send_handler=ProgressSendHandler(pulsar=self.__pulsar,
                                 request_msg=request_msg,
                                 msg_props={'additional': 'some addtional property'})

Once we have a send_handler we can use it to create the ‘root’ progress report for the request. In case we already know how many steps (sub-reports) there are going to be on the next level, we can pass it via the optional steps argument.

root_report = ProgressReport(step_message="Label/message of the root report",
                                 send_handler=send_handler,
                                 steps=2)

Once we have the root report instance we create new subreports for it via the create_subreport method. Each created report is published automatically upon creation and 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

For now there is now distinct error flag in the report. But you can update the step_message prop before marking it as complete to indicate an error.

# 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()

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.1.2.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file deprogressapi-0.1.2.tar.gz.

File metadata

  • Download URL: deprogressapi-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for deprogressapi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0eb28829b904e040d392fceb0c72ba8970050f3d28adf69dd4ca1445bb02fa66
MD5 5674fbbf9d9ec26f0fda5d080439cfd1
BLAKE2b-256 aaa58b11db2f0ccab3951fafe76ccf4fa2dcf798c152834a151de60434f4e061

See more details on using hashes here.

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