| Name | nwnsdk JSON |
| Version |
0.0.12
JSON |
| download |
| home_page | |
| Summary | Nieuwe Warmte Nu - compute engine sdk python |
| upload_time | 2023-11-14 08:16:22 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.8 |
| license | |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Compute engine sdk python
Nieuwe Warmte Nu
## Usage
Install in development mode, in root directory:
```
pip install -e .
```
or install from pypi:
```
pip install nwnsdk
```
For testing locally with RabbitMQ and Postgres on docker desktop clone https://github.com/Nieuwe-Warmte-Nu/computation-engine, copy `.env-template` to `.env` and in the root directory:
```
docker-compose up
```
Example usage
```python
from uuid import uuid4
from nwnsdk import NwnClient, WorkFlowType, PostgresConfig, RabbitmqConfig
postgres_config = PostgresConfig(
"localhost",
5432,
"nieuwewarmtenu",
"root",
"1234",
)
rabbitmq_config = RabbitmqConfig(
"localhost",
5672,
"nwn",
"root",
"5678",
)
nwn_client = NwnClient(postgres_config, rabbitmq_config)
try:
nwn_client.connect()
job_id1: uuid4 = nwn_client.start_work_flow(
WorkFlowType.GROW_OPTIMIZER, "test_job1", "esdl_string", "test_user1", "test_proj"
)
job_id2: uuid4 = nwn_client.start_work_flow(
WorkFlowType.GROW_OPTIMIZER, "test_job2", "esdl_string", "test_user2", "test_proj"
)
print(job_id1)
job1_input_esdl = nwn_client.get_job_input_esdl(job_id1)
print(f"===== job1 input ESDL: {job1_input_esdl}")
job1_status = nwn_client.get_job_status(job_id1)
print(f"===== job1 status: {job1_status}")
job1 = nwn_client.get_job_details(job_id1)
print(f"===== {job1.job_name} input esdl: {job1.input_esdl}")
jobs_all = nwn_client.get_all_jobs()
print(f"===== {jobs_all[1].job_name} added at: {jobs_all[1].added_at}")
jobs_from_ids = nwn_client.get_jobs_from_ids([job_id1, job_id2])
print(f"===== {jobs_from_ids[1].job_name} added at: {jobs_from_ids[1].added_at}")
jobs_from_user = nwn_client.get_jobs_from_user("test_user1")
print(f"===== Jobs from test_user1 added at: {','.join([str(job.added_at) for job in jobs_from_user])}")
jobs_from_project = nwn_client.get_jobs_from_project("test_proj")
print(f"===== Jobs from test_proj added at: {','.join([str(job.added_at) for job in jobs_from_project])}")
print(f"===== Deleted job with id '{job_id1}': {nwn_client.delete_job(job_id1)}")
finally:
nwn_client.stop()
```
## Release
This package is released on pypi [here](https://pypi.org/project/nwnsdk/) whenever a new tag is pushed.
In order to release this package:
1. Make sure that all relevant merge requests and commits have been merged to the main and/or poc-release branch.
2. Run `git checkout main` or `git checkout poc-release` to switch to the release branch.
3. Run `git pull origin main` or `git pull origin poc-release` to pull all latest changes.
4. Run `git tag <new_version>` where `<new_version>` is the new version number.
5. Run `git push origin <new_version>` to push the tag to Github.
6. Check [Github](https://github.com/Nieuwe-Warmte-Nu/compute-engine-sdk-python/actions) to confirm the release is
processed without errors.
7. Once the release has finished, confirm the new version is available on [pypi](https://pypi.org/project/nwnsdk/).
Raw data
{
"_id": null,
"home_page": "",
"name": "nwnsdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "NieuweWarmteNu <info@nwn.nu>",
"download_url": "https://files.pythonhosted.org/packages/36/a6/f4f7ad4d307fd17af84bd8696f1638dd993841bee8791f15226ed5c0ad8c/nwnsdk-0.0.12.tar.gz",
"platform": null,
"description": "# Compute engine sdk python\nNieuwe Warmte Nu\n\n\n## Usage\nInstall in development mode, in root directory:\n```\npip install -e .\n```\n\nor install from pypi:\n```\npip install nwnsdk\n```\n\nFor testing locally with RabbitMQ and Postgres on docker desktop clone https://github.com/Nieuwe-Warmte-Nu/computation-engine, copy `.env-template` to `.env` and in the root directory:\n```\ndocker-compose up\n```\n\nExample usage\n\n```python\nfrom uuid import uuid4\nfrom nwnsdk import NwnClient, WorkFlowType, PostgresConfig, RabbitmqConfig\n\npostgres_config = PostgresConfig(\n \"localhost\",\n 5432,\n \"nieuwewarmtenu\",\n \"root\",\n \"1234\",\n)\nrabbitmq_config = RabbitmqConfig(\n \"localhost\",\n 5672,\n \"nwn\",\n \"root\",\n \"5678\",\n)\nnwn_client = NwnClient(postgres_config, rabbitmq_config)\ntry:\n nwn_client.connect()\n job_id1: uuid4 = nwn_client.start_work_flow(\n WorkFlowType.GROW_OPTIMIZER, \"test_job1\", \"esdl_string\", \"test_user1\", \"test_proj\"\n )\n job_id2: uuid4 = nwn_client.start_work_flow(\n WorkFlowType.GROW_OPTIMIZER, \"test_job2\", \"esdl_string\", \"test_user2\", \"test_proj\"\n )\n print(job_id1)\n \n job1_input_esdl = nwn_client.get_job_input_esdl(job_id1)\n print(f\"===== job1 input ESDL: {job1_input_esdl}\")\n \n job1_status = nwn_client.get_job_status(job_id1)\n print(f\"===== job1 status: {job1_status}\")\n \n job1 = nwn_client.get_job_details(job_id1)\n print(f\"===== {job1.job_name} input esdl: {job1.input_esdl}\")\n \n jobs_all = nwn_client.get_all_jobs()\n print(f\"===== {jobs_all[1].job_name} added at: {jobs_all[1].added_at}\")\n \n \n jobs_from_ids = nwn_client.get_jobs_from_ids([job_id1, job_id2])\n print(f\"===== {jobs_from_ids[1].job_name} added at: {jobs_from_ids[1].added_at}\")\n \n \n jobs_from_user = nwn_client.get_jobs_from_user(\"test_user1\")\n print(f\"===== Jobs from test_user1 added at: {','.join([str(job.added_at) for job in jobs_from_user])}\")\n \n \n jobs_from_project = nwn_client.get_jobs_from_project(\"test_proj\")\n print(f\"===== Jobs from test_proj added at: {','.join([str(job.added_at) for job in jobs_from_project])}\")\n \n print(f\"===== Deleted job with id '{job_id1}': {nwn_client.delete_job(job_id1)}\")\nfinally:\n nwn_client.stop()\n\n```\n\n## Release\nThis package is released on pypi [here](https://pypi.org/project/nwnsdk/) whenever a new tag is pushed.\nIn order to release this package:\n\n1. Make sure that all relevant merge requests and commits have been merged to the main and/or poc-release branch.\n2. Run `git checkout main` or `git checkout poc-release` to switch to the release branch.\n3. Run `git pull origin main` or `git pull origin poc-release` to pull all latest changes.\n4. Run `git tag <new_version>` where `<new_version>` is the new version number.\n5. Run `git push origin <new_version>` to push the tag to Github.\n6. Check [Github](https://github.com/Nieuwe-Warmte-Nu/compute-engine-sdk-python/actions) to confirm the release is\n processed without errors.\n7. Once the release has finished, confirm the new version is available on [pypi](https://pypi.org/project/nwnsdk/).\n",
"bugtrack_url": null,
"license": "",
"summary": "Nieuwe Warmte Nu - compute engine sdk python",
"version": "0.0.12",
"project_urls": {
"Bug Tracker": "https://github.com/pypa/sampleproject/issues",
"Homepage": "https://github.com/pypa/sampleproject"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8f07fd2dfebdbe1b97df0059fb9b1129f9a25455bb864d631878074ef1d42441",
"md5": "7e329dfc7e8f5eae242b195b2b1103e2",
"sha256": "2276d7617a9cbabf1eea4b4c28f6c574277fecf6df3e60eef278bcb661c10993"
},
"downloads": -1,
"filename": "nwnsdk-0.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7e329dfc7e8f5eae242b195b2b1103e2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21961,
"upload_time": "2023-11-14T08:16:21",
"upload_time_iso_8601": "2023-11-14T08:16:21.214898Z",
"url": "https://files.pythonhosted.org/packages/8f/07/fd2dfebdbe1b97df0059fb9b1129f9a25455bb864d631878074ef1d42441/nwnsdk-0.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36a6f4f7ad4d307fd17af84bd8696f1638dd993841bee8791f15226ed5c0ad8c",
"md5": "38f4c201f8feb1be04178e0c8b1bcbd8",
"sha256": "0ab5a102755400ac64e25a237456e3b0d1dfbf6e8b724a2c5902439c20422f90"
},
"downloads": -1,
"filename": "nwnsdk-0.0.12.tar.gz",
"has_sig": false,
"md5_digest": "38f4c201f8feb1be04178e0c8b1bcbd8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 21093,
"upload_time": "2023-11-14T08:16:22",
"upload_time_iso_8601": "2023-11-14T08:16:22.504901Z",
"url": "https://files.pythonhosted.org/packages/36/a6/f4f7ad4d307fd17af84bd8696f1638dd993841bee8791f15226ed5c0ad8c/nwnsdk-0.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-14 08:16:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pypa",
"github_project": "sampleproject",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "nwnsdk"
}