dnv-onecompute


Namednv-onecompute JSON
Version 10.5.0 PyPI version JSON
download
home_pageNone
SummaryPython package for seamless integration with OneCompute Platform. Streamline job management, workflows, and file operations using intuitive REST APIs. Monitor job progress and efficiently handle file uploads and downloads.
upload_time2024-11-21 13:07:39
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 DNV AS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords onecompute workflow
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OneCompute

Python package for integration with the OneCompute cloud platform. Streamline job management, workflows, and file operations over REST APIs. Monitor job progress and efficiently handle file uploads and downloads.

Empower your Python workflows with seamless integration using our advanced OneCompute cloud platform package. Effortlessly manage complex jobs, streamline workflows, and facilitate efficient file operations through our user-friendly REST APIs. Process workflows both locally and on the cloud to optimize performance and resource utilization. Stay on top of job progress with real-time monitoring capabilities and experience hassle-free handling of file uploads and downloads for a truly streamlined cloud computing experience.

# Usage

## Introduction

This project demonstrates how to run a workflow locally using the OneCompute platform. The provided code snippet utilizes the `dnv-oneworkflow` Python package to interact with the OneCompute platform and execute a simple workflow locally. The example showcases the setup of the local workflow runtime service and the submission of a job for execution.

## Prerequisites

Make sure you have the following prerequisites installed:

- Python 3.10.x or higher
- Pip (Python package manager)
- [dnv-oneworkflow](https://test.pypi.org/project/dnv-oneworkflow/) Python package for the `PythonCommand` module.

  Use the following command to install the `dnv.oneworkflow` package:

  ```bash
  pip install dnv.oneworkflow
  ```

- Install the LocalWorkflowRuntimeService using the following command within your Python environment:
  ```python
  await PackageManager().install_package_async(
      "LocalWorkflowRuntime", "win-x64", PackageManager.Repository.DEV
  )
  ```

## Code

```python
import asyncio
import os

from dnv.onecompute import (
    AutoDeployOption,
    Job,
    LocalWorkflowRuntimeServiceManager,
    OneComputeClient,
    WorkUnit,
)
from dnv.oneworkflow.python_command import PythonCommand


async def run_workflow_locally_async():
    """
    Run a workflow locally using the OneCompute platform.
    """
    # Define constants
    OC_APPS_PATH = os.path.join(os.environ["LOCALAPPDATA"], "OneCompute")
    RUNTIME_SERVICE_PATH = os.path.join(OC_APPS_PATH, "LocalWorkflowRuntime", "wc.exe")
    WORKSPACE_ID = "MyWorkspace"
    SERVICE_NAME = "OneWorkflowWorkerHost"

    # Configure the local workflow runtime service
    workflow_runtime_service = LocalWorkflowRuntimeServiceManager(
        workspace_id=WORKSPACE_ID,
        worker_host_apps_path=OC_APPS_PATH,
        workflow_runtime_executable_path=RUNTIME_SERVICE_PATH,
        console_window_visible=True,
        auto_deploy_option=AutoDeployOption.DEV,
        startup_wait_time=10,
    )

    # Set up the OneCompute client
    url = workflow_runtime_service.workflow_runtime_service_endpoint
    oc_client = OneComputeClient(base_url=url, authenticator=None)

    # Start the local workflow runtime service
    workflow_runtime_service.start_service()

    # Define the Python command for the work unit
    py_cmd = PythonCommand(inline_script="print('Hello OneCompute')")
    work_unit = WorkUnit(py_cmd)
    work_unit.command = SERVICE_NAME

    # Define the job with necessary configurations
    job = Job()
    job.work = work_unit
    job.service_name = SERVICE_NAME
    job.properties = {"OW_WorkspaceId": WORKSPACE_ID}

    # Submit the job and await its termination
    job_monitor = await oc_client.submit_job_async(job)
    await job_monitor.await_job_termination_async()

    # Stop the local workflow runtime service
    workflow_runtime_service.stop_service()


if __name__ == "__main__":
    # Run the main asynchronous function
    asyncio.run(run_workflow_locally_async())
```

## License

[MIT](https://choosealicense.com/licenses/mit/)

## Support

If you encounter any issues, have questions, or want to provide feedback, please get in touch with our support team at software.support@dnv.com. We are committed to continuously improving OneCompute and providing timely assistance to our users.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dnv-onecompute",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "onecompute, workflow",
    "author": null,
    "author_email": "DNV AS <software.support@dnv.com>",
    "download_url": "https://files.pythonhosted.org/packages/7a/a2/c117a383b94342b706c0287bc19954b7a06c70ee76ebff0143ec614b3f03/dnv_onecompute-10.5.0.tar.gz",
    "platform": null,
    "description": "# OneCompute\r\n\r\nPython package for integration with the OneCompute cloud platform. Streamline job management, workflows, and file operations over REST APIs. Monitor job progress and efficiently handle file uploads and downloads.\r\n\r\nEmpower your Python workflows with seamless integration using our advanced OneCompute cloud platform package. Effortlessly manage complex jobs, streamline workflows, and facilitate efficient file operations through our user-friendly REST APIs. Process workflows both locally and on the cloud to optimize performance and resource utilization. Stay on top of job progress with real-time monitoring capabilities and experience hassle-free handling of file uploads and downloads for a truly streamlined cloud computing experience.\r\n\r\n# Usage\r\n\r\n## Introduction\r\n\r\nThis project demonstrates how to run a workflow locally using the OneCompute platform. The provided code snippet utilizes the `dnv-oneworkflow` Python package to interact with the OneCompute platform and execute a simple workflow locally. The example showcases the setup of the local workflow runtime service and the submission of a job for execution.\r\n\r\n## Prerequisites\r\n\r\nMake sure you have the following prerequisites installed:\r\n\r\n- Python 3.10.x or higher\r\n- Pip (Python package manager)\r\n- [dnv-oneworkflow](https://test.pypi.org/project/dnv-oneworkflow/) Python package for the `PythonCommand` module.\r\n\r\n  Use the following command to install the `dnv.oneworkflow` package:\r\n\r\n  ```bash\r\n  pip install dnv.oneworkflow\r\n  ```\r\n\r\n- Install the LocalWorkflowRuntimeService using the following command within your Python environment:\r\n  ```python\r\n  await PackageManager().install_package_async(\r\n      \"LocalWorkflowRuntime\", \"win-x64\", PackageManager.Repository.DEV\r\n  )\r\n  ```\r\n\r\n## Code\r\n\r\n```python\r\nimport asyncio\r\nimport os\r\n\r\nfrom dnv.onecompute import (\r\n    AutoDeployOption,\r\n    Job,\r\n    LocalWorkflowRuntimeServiceManager,\r\n    OneComputeClient,\r\n    WorkUnit,\r\n)\r\nfrom dnv.oneworkflow.python_command import PythonCommand\r\n\r\n\r\nasync def run_workflow_locally_async():\r\n    \"\"\"\r\n    Run a workflow locally using the OneCompute platform.\r\n    \"\"\"\r\n    # Define constants\r\n    OC_APPS_PATH = os.path.join(os.environ[\"LOCALAPPDATA\"], \"OneCompute\")\r\n    RUNTIME_SERVICE_PATH = os.path.join(OC_APPS_PATH, \"LocalWorkflowRuntime\", \"wc.exe\")\r\n    WORKSPACE_ID = \"MyWorkspace\"\r\n    SERVICE_NAME = \"OneWorkflowWorkerHost\"\r\n\r\n    # Configure the local workflow runtime service\r\n    workflow_runtime_service = LocalWorkflowRuntimeServiceManager(\r\n        workspace_id=WORKSPACE_ID,\r\n        worker_host_apps_path=OC_APPS_PATH,\r\n        workflow_runtime_executable_path=RUNTIME_SERVICE_PATH,\r\n        console_window_visible=True,\r\n        auto_deploy_option=AutoDeployOption.DEV,\r\n        startup_wait_time=10,\r\n    )\r\n\r\n    # Set up the OneCompute client\r\n    url = workflow_runtime_service.workflow_runtime_service_endpoint\r\n    oc_client = OneComputeClient(base_url=url, authenticator=None)\r\n\r\n    # Start the local workflow runtime service\r\n    workflow_runtime_service.start_service()\r\n\r\n    # Define the Python command for the work unit\r\n    py_cmd = PythonCommand(inline_script=\"print('Hello OneCompute')\")\r\n    work_unit = WorkUnit(py_cmd)\r\n    work_unit.command = SERVICE_NAME\r\n\r\n    # Define the job with necessary configurations\r\n    job = Job()\r\n    job.work = work_unit\r\n    job.service_name = SERVICE_NAME\r\n    job.properties = {\"OW_WorkspaceId\": WORKSPACE_ID}\r\n\r\n    # Submit the job and await its termination\r\n    job_monitor = await oc_client.submit_job_async(job)\r\n    await job_monitor.await_job_termination_async()\r\n\r\n    # Stop the local workflow runtime service\r\n    workflow_runtime_service.stop_service()\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    # Run the main asynchronous function\r\n    asyncio.run(run_workflow_locally_async())\r\n```\r\n\r\n## License\r\n\r\n[MIT](https://choosealicense.com/licenses/mit/)\r\n\r\n## Support\r\n\r\nIf you encounter any issues, have questions, or want to provide feedback, please get in touch with our support team at software.support@dnv.com. We are committed to continuously improving OneCompute and providing timely assistance to our users.\r\n",
    "bugtrack_url": null,
    "license": "MIT License Copyright (c) 2024 DNV AS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python package for seamless integration with OneCompute Platform. Streamline job management, workflows, and file operations using intuitive REST APIs. Monitor job progress and efficiently handle file uploads and downloads.",
    "version": "10.5.0",
    "project_urls": {
        "Changelog": "https://onecompute.dnv.com/docs/userguide/guide/ReleaseNotes.html",
        "Documentation": "https://onecompute.dnv.com/docs",
        "Homepage": "https://onecompute.dnv.com/docs/userguide"
    },
    "split_keywords": [
        "onecompute",
        " workflow"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfd1f69731ecc46c6eb96c70d23121585a95a934035cb499a26537c3aef622b8",
                "md5": "ec1d7240af3bcc8ef76dfc710f791c9a",
                "sha256": "9c17d56e5493cd6250f036a4813c7d756305d0c1d75f852e8b1edba6ba062e0c"
            },
            "downloads": -1,
            "filename": "dnv_onecompute-10.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ec1d7240af3bcc8ef76dfc710f791c9a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 55344,
            "upload_time": "2024-11-21T13:07:37",
            "upload_time_iso_8601": "2024-11-21T13:07:37.902189Z",
            "url": "https://files.pythonhosted.org/packages/cf/d1/f69731ecc46c6eb96c70d23121585a95a934035cb499a26537c3aef622b8/dnv_onecompute-10.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7aa2c117a383b94342b706c0287bc19954b7a06c70ee76ebff0143ec614b3f03",
                "md5": "73b00ec3d314bc8be3c532fa0ddbff44",
                "sha256": "de308891ecf83bf3a80a1795780994ad24d2e8fdfcf0382f931fb7f542d9ef23"
            },
            "downloads": -1,
            "filename": "dnv_onecompute-10.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "73b00ec3d314bc8be3c532fa0ddbff44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 47685,
            "upload_time": "2024-11-21T13:07:39",
            "upload_time_iso_8601": "2024-11-21T13:07:39.793383Z",
            "url": "https://files.pythonhosted.org/packages/7a/a2/c117a383b94342b706c0287bc19954b7a06c70ee76ebff0143ec614b3f03/dnv_onecompute-10.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 13:07:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dnv-onecompute"
}
        
Elapsed time: 0.41809s