{"id":20749298,"url":"https://github.com/agnostiqhq/covalent-azurebatch-plugin","last_synced_at":"2025-04-28T12:45:59.310Z","repository":{"id":173470768,"uuid":"561476859","full_name":"AgnostiqHQ/covalent-azurebatch-plugin","owner":"AgnostiqHQ","description":"Executor plugin interfacing Covalent with Azure Batch","archived":false,"fork":false,"pushed_at":"2025-03-03T16:59:20.000Z","size":152,"stargazers_count":4,"open_issues_count":9,"forks_count":0,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2025-03-25T07:01:49.647Z","etag":null,"topics":["batch","cloud-computing","covalent","microsoft-azure","python","python3","quantum-computing"],"latest_commit_sha":null,"homepage":"https://covalent.xyz","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgnostiqHQ.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-03T19:23:06.000Z","updated_at":"2023-09-29T09:37:15.000Z","dependencies_parsed_at":"2023-09-26T00:03:40.600Z","dependency_job_id":"3fa14390-1ed4-4d69-8f61-ce239b0c84e8","html_url":"https://github.com/AgnostiqHQ/covalent-azurebatch-plugin","commit_stats":null,"previous_names":["agnostiqhq/covalent-azurebatch-plugin"],"tags_count":4,"template":false,"template_full_name":"AgnostiqHQ/covalent-executor-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgnostiqHQ%2Fcovalent-azurebatch-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgnostiqHQ%2Fcovalent-azurebatch-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgnostiqHQ%2Fcovalent-azurebatch-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgnostiqHQ%2Fcovalent-azurebatch-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgnostiqHQ","download_url":"https://codeload.github.com/AgnostiqHQ/covalent-azurebatch-plugin/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251316210,"owners_count":21569942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","cloud-computing","covalent","microsoft-azure","python","python3","quantum-computing"],"created_at":"2024-11-17T08:22:09.721Z","updated_at":"2025-04-28T12:45:59.278Z","avatar_url":"https://github.com/AgnostiqHQ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u0026nbsp;\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/azure_batch_readme_banner.svg\" width=150%\u003e\n\n\u003c/div\u003e\n\n## Covalent Azure Batch Plugin\n\nCovalent is a Pythonic workflow tool used to execute tasks on advanced computing hardware. This executor plugin interfaces Covalent with [Microsoft Azure Batch](https://azure.microsoft.com/en-us/products/batch/#overview).\n\n## 1. Installation\n\nTo use this plugin with Covalent, install it using `pip`:\n\n```sh\npip install covalent-azurebatch-plugin\n```\n\n## 2. Usage Example\n\nThis is an example of how a workflow can be constructed to use the Azure Batch executor. In the example, we train a Support Vector Machine (SVM) and use an instance of the executor to execute the `train_svm` electron. Note that we also require [DepsPip](https://covalent.readthedocs.io/en/latest/concepts/concepts.html#depspip) which will be required to execute the electrons.\n\n```python\nfrom numpy.random import permutation\nfrom sklearn import svm, datasets\nimport covalent as ct\n\nfrom covalent.executor import AzureBatchExecutor\n\ndeps_pip = ct.DepsPip(\n    packages=[\"numpy==1.22.4\", \"scikit-learn==1.1.2\"]\n)\n\nexecutor = AzureBatchExecutor(\n    tenant_id=\"tenant-id\",\n    client_id=\"client-id\",\n    client_secret=\"client-secret\",\n    batch_account_url=\"https://covalent.eastus.batch.azure.com\",\n    batch_account_domain=\"batch.core.windows.net\",\n    storage_account_name=\"covalentbatch\",\n    storage_account_domain=\"blob.core.windows.net\",\n    base_image_uri=\"covalent.azurecr.io/covalent-executor-base:latest\",\n    pool_id=\"covalent-pool\",\n    retries=3,\n    time_limit=300,\n    cache_dir=\"/tmp/covalent\",\n    poll_freq=10\n)\n\n\n# Use executor plugin to train our SVM model\n@ct.electron(\n    executor=executor,\n    deps_pip=deps_pip\n)\ndef train_svm(data, C, gamma):\n    X, y = data\n    clf = svm.SVC(C=C, gamma=gamma)\n    clf.fit(X[90:], y[90:])\n    return clf\n\n@ct.electron\ndef load_data():\n    iris = datasets.load_iris()\n    perm = permutation(iris.target.size)\n    iris.data = iris.data[perm]\n    iris.target = iris.target[perm]\n    return iris.data, iris.target\n\n@ct.electron\ndef score_svm(data, clf):\n    X_test, y_test = data\n    return clf.score(\n    \tX_test[:90],y_test[:90]\n    )\n\n@ct.lattice\ndef run_experiment(C=1.0, gamma=0.7):\n    data = load_data()\n    clf = train_svm(\n    \tdata=data,\n\t    C=C,\n\t    gamma=gamma\n    )\n    score = score_svm(\n    \tdata=data,\n\t    clf=clf\n    )\n    return score\n\n# Dispatch the workflow.\ndispatch_id = ct.dispatch(run_experiment)(\n        C=1.0,\n        gamma=0.7\n)\n\n# Wait for our result and get result value\nresult = ct.get_result(dispatch_id, wait=True).result\n\nprint(result)\n```\n\nDuring the execution of the workflow, one can navigate to the UI to see the status of the workflow. Once completed, the above script should also output a value with the score of our model.\n\n```sh\n0.8666666666666667\n```\n\nIn order for the above workflow to run successfully, one has to provision the required cloud resources as mentioned in the section [Required Microsoft Azure Batch Resources](#-required-microsoft-azure-batch-resources).\n\n## 3. Configuration\n\nThere are many configuration options that can be passed in to the class `ct.executor.AzureBatchExecutor` or by modifying the [covalent config file](https://covalent.readthedocs.io/en/latest/how_to/config/customization.html) under the section `[executors.azurebatch]`.\n\nFor more information about all of the possible configuration values visit our [read the docs (RTD) guide](https://covalent.readthedocs.io/en/latest/api/executors/azurebatch.html#overview-of-configuration) for this plugin.\n\n## 4. Required Microsoft Azure Resources\n\nIn order to run your workflows with covalent there are a few notable Microsoft Azure resources that need to be provisioned first.\n\nThe required Azure resources are:\n\n    1. Batch account\n\n    2. Storage account\n\n    3. Resource group\n\n    4. Container registry (custom images only)\n\n    5. Pool of compute nodes\n\nFor more information regarding which cloud resources need to be provisioned visit our [read the docs (RTD) guide](https://covalent.readthedocs.io/en/latest/api/executors/azurebatch.html#required-cloud-resources) for this plugin.\n\n## Getting Started with Covalent\n\nFor more information on how to get started with Covalent, check out the project [homepage](https://github.com/AgnostiqHQ/covalent) and the official [documentation](https://covalent.readthedocs.io/en/latest/).\n\n## Release Notes\n\nRelease notes are available in the [Changelog](https://github.com/AgnostiqHQ/covalent-azurebatch-plugin/blob/main/CHANGELOG.md).\n\n## Citation\n\nPlease use the following citation in any publications:\n\n\u003e W. J. Cunningham, S. K. Radha, F. Hasan, J. Kanem, S. W. Neagle, and S. Sanand.\n\u003e _Covalent._ Zenodo, 2022. https://doi.org/10.5281/zenodo.5903364\n\n## License\n\nCovalent is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/AgnostiqHQ/covalent-azurebatch-plugin/blob/main/LICENSE) file or contact the [support team](mailto:support@agnostiq.ai) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagnostiqhq%2Fcovalent-azurebatch-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagnostiqhq%2Fcovalent-azurebatch-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagnostiqhq%2Fcovalent-azurebatch-plugin/lists"}