Python API Client for CMF
Project description
cmfapi
This package provides a simple, modular SDK for the Common Metadata Framework (CMF) REST API.
Installation
Install using pip:
pip install cmfapi
Install from source:
git clone https://github.com/atripathy86/cmfapi.git
cd cmfapi
pip install -e .
Build/Upload for pypi:
pip install build
# Build the package
python -m build
#Creates dist/ with tar.gz and .whl
- Verify ~/.pypirc has PyPi token
pip install twine
twine upload dist/*
Quick Start
Initialize the Client
from cmfapi import cmfClient
client = cmfClient("http://192.168.2.143:8080")
Example Usage
See test.py
Get CMF API Server Pipelines
pipelines = client.get_pipelines()
print(pipelines)
Get list of executions for a pipeline
if pipelines: # Check if the list is not empty
first_pipeline = pipelines[0]
executions_list = client.get_executions_list(first_pipeline)
print(f"Executions List for {first_pipeline}:")
print(json.dumps(executions_list, indent=4))
Get Execution details for a pipeline
executions = client.get_executions(first_pipeline)
print(f"Executions for {first_pipeline}:")
print(json.dumps(executions, indent=4))
Get Artifact Types in DB
artifact_types = client.get_artifact_types()
print("Artifact Types in DB:")
print(json.dumps(artifact_types, indent=4))
Display Artifacts for a pipeline
if artifact_types:
first_artifact_type = artifact_types[0]
print(f"First Artifact Type: {first_artifact_type}")
artifacts = client.get_artifacts(first_pipeline, first_artifact_type)
print(f"Artifacts for {first_pipeline} of type {first_artifact_type}:")
print(json.dumps(artifacts, indent=4))
Fetch artifact lineage for a pipeline
artifact_lineage_tree = client.get_artifact_lineage_tangled_tree(first_pipeline)
print(f"Artifact Lineage Tree for {first_pipeline}:")
print(json.dumps(artifact_lineage_tree, indent=4))
Fetch execution lineage for a pipeline
#Select a particular UUID
if "items" in executions and len(executions["items"]) > 0:
first_execution = executions["items"][0] # Get the first execution item
execution_uuid = first_execution["Execution_uuid"] # Access the Execution_uuid field
selected_uuid = execution_uuid[:4] # Slice the first 4 characters
print(f"Selected Execution UUID (First 4 characters): {selected_uuid}")
else:
print("No executions found.")
uuid = selected_uuid # Example UUID
pipeline_name = first_pipeline # Use the first pipeline from the pipelines list
execution_lineage_tree = client.get_execution_lineage_tangled_tree(uuid, pipeline_name)
print(f"Execution Lineage Tree for UUID {uuid} and Pipeline {pipeline_name}:")
print(json.dumps(execution_lineage_tree, indent=4))
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
cmfapi-0.0.2.tar.gz
(9.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cmfapi-0.0.2.tar.gz.
File metadata
- Download URL: cmfapi-0.0.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df4230ec4eb09142abc4fce4261f53e4886ddd3e9e1d5ae24bdc5826c7a32c1b
|
|
| MD5 |
42c6b120f8f59586b9b466543aa40d3c
|
|
| BLAKE2b-256 |
8630c7ebcc0f599d9ddce212953352e77b8fe36573ff2a7805310bcdf91ca75f
|
File details
Details for the file cmfapi-0.0.2-py3-none-any.whl.
File metadata
- Download URL: cmfapi-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac25db0230c99149677511fa20b7e0a4e5a084c2018d354f67e6fca4e5abceb2
|
|
| MD5 |
8833bc4fef7739d95b1e93007598bd76
|
|
| BLAKE2b-256 |
f5876c900f8f7a575c1a1a081b5409b1b7d132812c49df7b9efd61544a324d0a
|