Send custom, realtime logs to Pantomath through the Pantomath Python SDK
Project description
Pantomath SDK
Installation and Setup
-
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.
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pantomath_sdk-0.2.0.tar.gz
.
File metadata
- Download URL: pantomath_sdk-0.2.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdcfbc8681aa69ceed850f5b28ae0eeea01c3fdb3a3c834bd5e320f1ed365e9b |
|
MD5 | d40791946efa558e8c7a40c47617e0a8 |
|
BLAKE2b-256 | 418689037fec2d5446b6d136790e6eee784146ffbc892c195627bd271603f6ac |
File details
Details for the file pantomath_sdk-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pantomath_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 47.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee40fb22445ffadb04ded035d3a62fe8b43833721c72ffde1918d847771dc516 |
|
MD5 | f75e477e0a86c7ddf97f348ceb975f76 |
|
BLAKE2b-256 | 177fd7c6e00d0220c5de594d924a993cad41515370c1e787a60eefa74c4af285 |