Skip to main content

Send custom, realtime logs to Pantomath through the Pantomath Python SDK

Project description

Pantomath SDK

Installation and Setup

  1. Install the Pantomath SDK for Python:

    $ pip install pantomath-sdk
    

    This is the preferred method to install the Pantomath SDK, as it will always install the most recent stable release.

    If you don't have pip installed, this Python installation guide can guide you through the process.

  2. Add configuration ENVs to your runtime:

    PANTOMATH_API_BASE_URL = ******,
    PANTOMATH_API_KEY = ******
    

Example

from pantomath_sdk import PantomathSDK, AstroTask, S3Bucket, SnowflakePipe
from time import sleep

def main():
    # Create an instance of the PantomathSDK
    pantomath_sdk = PantomathSDK(api_key="****")

    # Construct your job
    astro_task = AstroTask(
        name="astro_task_1",
        dag_name="astro_dag_1",
        host_name="astro_host_1"
    )

    # Construct your source and target data sets
    source_data_sets = [
        S3Bucket(s3_bucket="s3://some-bucket-1/file.csv")
    ]

    target_data_sets = [
        SnowflakePipe(
            name="snowpipe_1",
            schema="snowflake_schema_1",
            database="snowflake_database_1",
            port=443,
            host="snowflake_host_1.example.com",
        )
    ]

    # Capture your job run
    job_run = pantomath_sdk.new_job_run(
        job=astro_task,
        source_data_sets=source_data_sets,
        target_data_sets=target_data_sets,
    )
    try:
        job_run.log_start(message="Starting Astro task")
        for i in range(5):
            job_run.log_progress(
                message=f"Completed step {i + 1}",
                records_effected=i * 100
            )
            sleep(2)
    except Exception as e:
        job_run.log_failure(message=e.message)
    finally:
        job_run.log_success(message="Succeeded!")

if __name__ == '__main__':
    main()

Limitations

The SDK will not publish logs to Pantomath until the Job Run has received a success or failure message via a call to log_success() or log_failure(). Therefore, the SDK is unable to trigger any latency incident events within Pantomath.

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

pantomath_sdk-0.3.0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pantomath_sdk-0.3.0-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

Details for the file pantomath_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: pantomath_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for pantomath_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 eaa24583956b6f00c34280b17501289a2dc4a7c4650c12bab17de9c429235029
MD5 2e1ae57c9f3e1fac7fa59c6a48fef176
BLAKE2b-256 8bbe0c5d132de8975734b83800e40a1520f5e92b05bdcf2cb4908d86e48e9968

See more details on using hashes here.

File details

Details for the file pantomath_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pantomath_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 55.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for pantomath_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3037ec81922518d50c68c7b62145066f509e7f61c22e3e42a46ad828eb802e99
MD5 dc34a7f4e3c39ea01274fa0349dc66dc
BLAKE2b-256 35c03d0e229864c8234d8b9e6f50855d03f71ccd33a8b104bb4012b5e4ae8acb

See more details on using hashes here.

Supported by

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