Name | prefect-azure JSON |
Version |
0.3.8
JSON |
| download |
home_page | None |
Summary | Prefect integrations with Microsoft Azure services |
upload_time | 2024-04-24 14:12:08 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Apache License 2.0 |
keywords |
prefect
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# prefect-azure
<p align="center">
<a href="https://pypi.python.org/pypi/prefect-azure/" alt="PyPI version">
<img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-azure?color=26272B&labelColor=090422"></a>
<a href="https://pepy.tech/badge/prefect-azure/" alt="Downloads">
<img src="https://img.shields.io/pypi/dm/prefect-azure?color=26272B&labelColor=090422" /></a>
</p>
`prefect-azure` is a collection of Prefect integrations for orchestration workflows with Azure.
## Getting Started
### Installation
Install `prefect-azure` with `pip`
```bash
pip install prefect-azure
```
To use Blob Storage:
```bash
pip install "prefect-azure[blob_storage]"
```
To use Cosmos DB:
```bash
pip install "prefect-azure[cosmos_db]"
```
To use ML Datastore:
```bash
pip install "prefect-azure[ml_datastore]"
```
## Examples
### Download a blob
```python
from prefect import flow
from prefect_azure import AzureBlobStorageCredentials
from prefect_azure.blob_storage import blob_storage_download
@flow
def example_blob_storage_download_flow():
connection_string = "connection_string"
blob_storage_credentials = AzureBlobStorageCredentials(
connection_string=connection_string,
)
data = blob_storage_download(
blob="prefect.txt",
container="prefect",
azure_credentials=blob_storage_credentials,
)
return data
example_blob_storage_download_flow()
```
Use `with_options` to customize options on any existing task or flow:
```python
custom_blob_storage_download_flow = example_blob_storage_download_flow.with_options(
name="My custom task name",
retries=2,
retry_delay_seconds=10,
)
```
### Run a command on an Azure container instance
```python
from prefect import flow
from prefect_azure import AzureContainerInstanceCredentials
from prefect_azure.container_instance import AzureContainerInstanceJob
@flow
def container_instance_job_flow():
aci_credentials = AzureContainerInstanceCredentials.load("MY_BLOCK_NAME")
container_instance_job = AzureContainerInstanceJob(
aci_credentials=aci_credentials,
resource_group_name="azure_resource_group.example.name",
subscription_id="<MY_AZURE_SUBSCRIPTION_ID>",
command=["echo", "hello world"],
)
return container_instance_job.run()
```
### Use Azure Container Instance as infrastructure
If we have `a_flow_module.py`:
```python
from prefect import flow, get_run_logger
@flow
def log_hello_flow(name="Marvin"):
logger = get_run_logger()
logger.info(f"{name} said hello!")
if __name__ == "__main__":
log_hello_flow()
```
We can run that flow using an Azure Container Instance, but first create the infrastructure block:
```python
from prefect_azure import AzureContainerInstanceCredentials
from prefect_azure.container_instance import AzureContainerInstanceJob
container_instance_job = AzureContainerInstanceJob(
aci_credentials=AzureContainerInstanceCredentials.load("MY_BLOCK_NAME"),
resource_group_name="azure_resource_group.example.name",
subscription_id="<MY_AZURE_SUBSCRIPTION_ID>",
)
container_instance_job.save("aci-dev")
```
Then, create the deployment either on the UI or through the CLI:
```bash
prefect deployment build a_flow_module.py:log_hello_flow --name aci-dev -ib container-instance-job/aci-dev
```
Visit [Prefect Deployments](https://docs.prefect.io/tutorials/deployments/) for more information about deployments.
## Azure Container Instance Worker
The Azure Container Instance worker is an excellent way to run
your workflows on Azure.
To get started, create an Azure Container Instances typed work pool:
```
prefect work-pool create -t azure-container-instance my-aci-work-pool
```
Then, run a worker that pulls jobs from the work pool:
```
prefect worker start -n my-aci-worker -p my-aci-work-pool
```
The worker should automatically read the work pool's type and start an
Azure Container Instance worker.
Raw data
{
"_id": null,
"home_page": null,
"name": "prefect-azure",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "prefect",
"author": null,
"author_email": "\"Prefect Technologies, Inc.\" <help@prefect.io>",
"download_url": "https://files.pythonhosted.org/packages/66/c5/aed69b353637bccc46c6d1e6d70337c758c1e6a5858d92dac294a73a1e7b/prefect_azure-0.3.8.tar.gz",
"platform": null,
"description": "# prefect-azure\n\n<p align=\"center\">\n <a href=\"https://pypi.python.org/pypi/prefect-azure/\" alt=\"PyPI version\">\n <img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/prefect-azure?color=26272B&labelColor=090422\"></a>\n <a href=\"https://pepy.tech/badge/prefect-azure/\" alt=\"Downloads\">\n <img src=\"https://img.shields.io/pypi/dm/prefect-azure?color=26272B&labelColor=090422\" /></a>\n</p>\n\n`prefect-azure` is a collection of Prefect integrations for orchestration workflows with Azure.\n\n## Getting Started\n\n### Installation\n\nInstall `prefect-azure` with `pip`\n\n```bash\npip install prefect-azure\n```\n\nTo use Blob Storage:\n```bash\npip install \"prefect-azure[blob_storage]\"\n```\n\nTo use Cosmos DB:\n```bash\npip install \"prefect-azure[cosmos_db]\"\n```\n\nTo use ML Datastore:\n```bash\npip install \"prefect-azure[ml_datastore]\"\n```\n\n## Examples\n\n### Download a blob\n\n```python\nfrom prefect import flow\n\nfrom prefect_azure import AzureBlobStorageCredentials\nfrom prefect_azure.blob_storage import blob_storage_download\n\n@flow\ndef example_blob_storage_download_flow():\n connection_string = \"connection_string\"\n blob_storage_credentials = AzureBlobStorageCredentials(\n connection_string=connection_string,\n )\n data = blob_storage_download(\n blob=\"prefect.txt\",\n container=\"prefect\",\n azure_credentials=blob_storage_credentials,\n )\n return data\n\nexample_blob_storage_download_flow()\n```\n\nUse `with_options` to customize options on any existing task or flow:\n```python\ncustom_blob_storage_download_flow = example_blob_storage_download_flow.with_options(\n name=\"My custom task name\",\n retries=2,\n retry_delay_seconds=10,\n)\n```\n\n### Run a command on an Azure container instance\n\n```python\nfrom prefect import flow\nfrom prefect_azure import AzureContainerInstanceCredentials\nfrom prefect_azure.container_instance import AzureContainerInstanceJob\n\n\n@flow\ndef container_instance_job_flow():\n aci_credentials = AzureContainerInstanceCredentials.load(\"MY_BLOCK_NAME\")\n container_instance_job = AzureContainerInstanceJob(\n aci_credentials=aci_credentials,\n resource_group_name=\"azure_resource_group.example.name\",\n subscription_id=\"<MY_AZURE_SUBSCRIPTION_ID>\",\n command=[\"echo\", \"hello world\"],\n )\n return container_instance_job.run()\n```\n\n### Use Azure Container Instance as infrastructure\n\nIf we have `a_flow_module.py`:\n\n```python\nfrom prefect import flow, get_run_logger\n\n@flow\ndef log_hello_flow(name=\"Marvin\"):\n logger = get_run_logger()\n logger.info(f\"{name} said hello!\")\n\nif __name__ == \"__main__\":\n log_hello_flow()\n```\n\nWe can run that flow using an Azure Container Instance, but first create the infrastructure block:\n\n```python\nfrom prefect_azure import AzureContainerInstanceCredentials\nfrom prefect_azure.container_instance import AzureContainerInstanceJob\n\ncontainer_instance_job = AzureContainerInstanceJob(\n aci_credentials=AzureContainerInstanceCredentials.load(\"MY_BLOCK_NAME\"),\n resource_group_name=\"azure_resource_group.example.name\",\n subscription_id=\"<MY_AZURE_SUBSCRIPTION_ID>\",\n)\ncontainer_instance_job.save(\"aci-dev\")\n```\n\nThen, create the deployment either on the UI or through the CLI:\n```bash\nprefect deployment build a_flow_module.py:log_hello_flow --name aci-dev -ib container-instance-job/aci-dev\n```\n\nVisit [Prefect Deployments](https://docs.prefect.io/tutorials/deployments/) for more information about deployments.\n\n## Azure Container Instance Worker\nThe Azure Container Instance worker is an excellent way to run \nyour workflows on Azure. \n\nTo get started, create an Azure Container Instances typed work pool:\n```\nprefect work-pool create -t azure-container-instance my-aci-work-pool\n```\n\nThen, run a worker that pulls jobs from the work pool:\n```\nprefect worker start -n my-aci-worker -p my-aci-work-pool\n```\n\nThe worker should automatically read the work pool's type and start an \nAzure Container Instance worker.\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Prefect integrations with Microsoft Azure services",
"version": "0.3.8",
"project_urls": {
"Homepage": "https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-azure"
},
"split_keywords": [
"prefect"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d13c5c9f9cde9dfdb4a9763d6b454ab5d29813f5eb6c22372da21e09dffff1a1",
"md5": "72cfa259643b0f4acbb23b12868807ab",
"sha256": "65c0d85f902efec96f11b46cf99dbb63006e0c849ac92900deaaa0c1c1d35c03"
},
"downloads": -1,
"filename": "prefect_azure-0.3.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72cfa259643b0f4acbb23b12868807ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 37174,
"upload_time": "2024-04-24T14:12:06",
"upload_time_iso_8601": "2024-04-24T14:12:06.939268Z",
"url": "https://files.pythonhosted.org/packages/d1/3c/5c9f9cde9dfdb4a9763d6b454ab5d29813f5eb6c22372da21e09dffff1a1/prefect_azure-0.3.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "66c5aed69b353637bccc46c6d1e6d70337c758c1e6a5858d92dac294a73a1e7b",
"md5": "6489062e8b8ca6241ef4ef4fb5b3ee05",
"sha256": "70fec73d3d4968e912c8d910eff77378012385978b3afb82451cefa27520cca1"
},
"downloads": -1,
"filename": "prefect_azure-0.3.8.tar.gz",
"has_sig": false,
"md5_digest": "6489062e8b8ca6241ef4ef4fb5b3ee05",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 55363,
"upload_time": "2024-04-24T14:12:08",
"upload_time_iso_8601": "2024-04-24T14:12:08.896660Z",
"url": "https://files.pythonhosted.org/packages/66/c5/aed69b353637bccc46c6d1e6d70337c758c1e6a5858d92dac294a73a1e7b/prefect_azure-0.3.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-24 14:12:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PrefectHQ",
"github_project": "prefect",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"requirements": [],
"lcname": "prefect-azure"
}