# Arcee
## *The OptScale ML profiling tool by Hystax*
Arcee is a tool that helps you to integrate ML tasks with [OptScale](https://my.optscale.com/).
This tool can automatically collect executor metadata from the cloud and process stats.
## Installation
Arcee requires Python 3.7+ to run.
To install the `optscale_arcee` package, use pip:
```sh
pip install optscale-arcee
```
## Import
Import the `optscale_arcee` module into your code as follows:
```sh
import optscale_arcee as arcee
```
## Initialization
To initialize the arcee collector use the `init` method with the following parameters:
- token (str, required): the profiling token.
- task_key (str, required): the task key for which you want to collect data.
- run_name (str, optional): the run name.
- endpoint_url (str, optional): the custom OptScale endpoint (default is https://my.optscale.com/arcee/v2).
- ssl (bool, optional): enable/disable SSL checks (self-signed SSL certificates support).
- period (int, optional): arcee daemon process heartbeat period in seconds (default is 1).
To initialize the collector using a context manager, use the following code snippet:
```sh
with arcee.init(token="YOUR-PROFILING-TOKEN",
task_key="YOUR-TASK-KEY",
run_name="YOUR-RUN-NAME",
endpoint_url="https://YOUR-OPTSCALE-PUBLIC-IP:443/arcee/v2",
ssl=SSL,
period=PERIOD):
# some code
```
Examples:
```sh
with arcee.init("00000000-0000-0000-0000-000000000000", "linear_regression",
run_name="My run name", ssl=True, period=1):
# some code
```
For custom OptScale deployments:
```sh
with arcee.init("00000000-0000-0000-0000-000000000000", "linear_regression",
run_name="My run name", endpoint_url="https://172.18.12.3:443/arcee/v2",
ssl=False, period=5):
# some code
```
This method automatically handles error catching and terminates arcee execution.
Alternatively, to get more control over error catching and execution finishing, you can initialize the collector using a corresponding method.
Note that this method will require you to manually handle errors or terminate arcee execution using the `error` and `finish` methods.
```sh
arcee.init(token="YOUR-PROFILING-TOKEN", task_key="YOUR-TASK-KEY")
# some code
arcee.finish()
# or in case of error
arcee.error()
```
## Sending metrics
To send metrics, use the `send` method with the following parameter:
- data (dict, required): a dictionary of metric names and their respective values (note that metric data values should be numeric).
```sh
arcee.send({"YOUR-METRIC-1-KEY": YOUR_METRIC_1_VALUE, "YOUR-METRIC-2-KEY": YOUR_METRIC_2_VALUE})
```
Example:
```sh
arcee.send({ "accuracy": 71.44, "loss": 0.37 })
```
## Adding hyperparameters
To add hyperparameters, use the `hyperparam` method with the following parameters:
- key (str, required): the hyperparameter name.
- value (str | number, required): the hyperparameter value.
```sh
arcee.hyperparam(key="YOUR-PARAM-KEY", value=YOUR_PARAM_VALUE)
```
Example:
```sh
arcee.hyperparam("EPOCHS", 100)
```
## Tagging task run
To tag a run, use the `tag` method with the following parameters:
- key (str, required): the tag name.
- value (str | number, required): the tag value.
```sh
arcee.tag(key="YOUR-TAG-KEY", value=YOUR_TAG_VALUE)
```
Example:
```sh
arcee.tag("Algorithm", "Linear Learn Algorithm")
```
## Adding milestone
To add a milestone, use the `milestone` method with the following parameter:
- name (str, required): the milestone name.
```sh
arcee.milestone(name="YOUR-MILESTONE-NAME")
```
Example:
```sh
arcee.milestone("Download training data")
```
## Adding stage
To add a stage, use the `stage` method with the following parameter:
- name (str, required): the stage name.
```sh
arcee.stage(name="YOUR-STAGE-NAME")
```
Example:
```sh
arcee.stage("preparing")
```
## Logging datasets
To log a dataset, use the `dataset` method with the following parameters:
- path (str, required): the dataset path.
- name (str, optional): the dataset name.
- description (str, optional): the dataset description.
- labels (list, optional): the dataset labels.
```sh
arcee.dataset(path="YOUR-DATASET-PATH",
name="YOUR-DATASET-NAME",
description="YOUR-DATASET-DESCRIPTION",
labels=["YOUR-DATASET-LABEL-1", "YOUR-DATASET-LABEL-2"])
```
Example:
```sh
arcee.dataset("https://s3/ml-bucket/datasets/training_dataset.csv",
name="Training dataset",
description="Training dataset (100k rows)",
labels=["training", "100k"])
```
## Creating models
To create a model, use the `model` method with the following parameters:
- key (str, required): the unique model key.
- path (str, optional): the run model path.
```sh
arcee.model(key="YOUR-MODEL-KEY", path="YOUR-MODEL-PATH")
```
Example:
```sh
arcee.model("my_model", "/home/user/my_model")
```
## Setting model version
To set a custom model version, use the `model_version` method with the following parameter:
- version (str, required): the version name.
```sh
arcee.model_version(version="YOUR-MODEL-VERSION")
```
Example:
```sh
arcee.model_version("1.2.3-release")
```
## Setting model version alias
To set a model version alias, use the `model_version_alias` method with the following parameter:
- alias (str, required): the alias name.
```sh
arcee.model_version_alias(alias="YOUR-MODEL-VERSION-ALIAS")
```
Example:
```sh
arcee.model_version_alias("winner")
```
## Setting model version tag
To add tags to a model version, use the `model_version_tag` method with the following parameters:
- key (str, required): the tag name.
- value (str | number, required): the tag value.
```sh
arcee.model_version_tag(key="YOUR-MODEL-VERSION-TAG-KEY", value=YOUR_MODEL_VERSION_TAG_VALUE)
```
Example:
```sh
arcee.model_version_tag("env", "staging demo")
```
## Creating artifacts
To create an artifact, use the `artifact` method with the following parameters:
- path (str, required): the run artifact path.
- name (str, optional): the artifact name.
- description (str, optional): the artifact description.
- tags (dict, optional): the artifact tags.
```sh
arcee.artifact(path="YOUR-ARTIFACT-PATH",
name="YOUR-ARTIFACT-NAME",
description="YOUR-ARTIFACT-DESCRIPTION",
tags={"YOUR-ARTIFACT-TAG-KEY": YOUR_ARTIFACT_TAG_VALUE})
```
Example:
```sh
arcee.artifact("https://s3/ml-bucket/artifacts/AccuracyChart.png",
name="Accuracy line chart",
description="The dependence of accuracy on the time",
tags={"env": "staging"})
```
## Setting artifact tag
To add a tag to an artifact, use the `artifact_tag` method with the following parameters:
- path (str, required): the run artifact path.
- key (str, required): the tag name.
- value (str | number, required): the tag value.
```sh
arcee.artifact_tag(path="YOUR-ARTIFACT-PATH",
key="YOUR-ARTIFACT-TAG-KEY",
value=YOUR_ARTIFACT_TAG_VALUE)
```
Example:
```sh
arcee.artifact_tag("https://s3/ml-bucket/artifacts/AccuracyChart.png",
"env", "staging demo")
```
## Finishing task run
To finish a run, use the `finish` method.
```sh
arcee.finish()
```
## Failing task run
To fail a run, use the `error` method.
```sh
arcee.error()
```
Raw data
{
"_id": null,
"home_page": "https://my.optscale.com/",
"name": "optscale-arcee",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.7",
"maintainer_email": null,
"keywords": "arcee, ml, optscale, finops, mlops",
"author": "Hystax",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ec/da/6a15993c1fae8b87b6d25fbd8e1514da3d02e90f7df7cb5d53df1665262b/optscale_arcee-0.1.47.tar.gz",
"platform": null,
"description": "# Arcee\n## *The OptScale ML profiling tool by Hystax*\n\nArcee is a tool that helps you to integrate ML tasks with [OptScale](https://my.optscale.com/).\nThis tool can automatically collect executor metadata from the cloud and process stats.\n\n## Installation\nArcee requires Python 3.7+ to run.\nTo install the `optscale_arcee` package, use pip:\n```sh\npip install optscale-arcee\n```\n\n## Import\nImport the `optscale_arcee` module into your code as follows:\n```sh\nimport optscale_arcee as arcee\n```\n\n## Initialization\nTo initialize the arcee collector use the `init` method with the following parameters:\n- token (str, required): the profiling token.\n- task_key (str, required): the task key for which you want to collect data.\n- run_name (str, optional): the run name.\n- endpoint_url (str, optional): the custom OptScale endpoint (default is https://my.optscale.com/arcee/v2).\n- ssl (bool, optional): enable/disable SSL checks (self-signed SSL certificates support).\n- period (int, optional): arcee daemon process heartbeat period in seconds (default is 1).\n\nTo initialize the collector using a context manager, use the following code snippet:\n```sh\nwith arcee.init(token=\"YOUR-PROFILING-TOKEN\",\n task_key=\"YOUR-TASK-KEY\",\n run_name=\"YOUR-RUN-NAME\",\n endpoint_url=\"https://YOUR-OPTSCALE-PUBLIC-IP:443/arcee/v2\",\n ssl=SSL,\n period=PERIOD):\n # some code\n```\n\nExamples:\n```sh\nwith arcee.init(\"00000000-0000-0000-0000-000000000000\", \"linear_regression\",\n run_name=\"My run name\", ssl=True, period=1):\n # some code\n```\nFor custom OptScale deployments:\n```sh\nwith arcee.init(\"00000000-0000-0000-0000-000000000000\", \"linear_regression\",\n run_name=\"My run name\", endpoint_url=\"https://172.18.12.3:443/arcee/v2\",\n ssl=False, period=5):\n # some code\n```\n\nThis method automatically handles error catching and terminates arcee execution.\n\nAlternatively, to get more control over error catching and execution finishing, you can initialize the collector using a corresponding method.\nNote that this method will require you to manually handle errors or terminate arcee execution using the `error` and `finish` methods.\n```sh\narcee.init(token=\"YOUR-PROFILING-TOKEN\", task_key=\"YOUR-TASK-KEY\")\n# some code\narcee.finish()\n# or in case of error\narcee.error()\n```\n\n## Sending metrics\nTo send metrics, use the `send` method with the following parameter:\n- data (dict, required): a dictionary of metric names and their respective values (note that metric data values should be numeric).\n```sh\narcee.send({\"YOUR-METRIC-1-KEY\": YOUR_METRIC_1_VALUE, \"YOUR-METRIC-2-KEY\": YOUR_METRIC_2_VALUE})\n```\nExample:\n```sh\narcee.send({ \"accuracy\": 71.44, \"loss\": 0.37 })\n```\n\n## Adding hyperparameters\nTo add hyperparameters, use the `hyperparam` method with the following parameters:\n- key (str, required): the hyperparameter name.\n- value (str | number, required): the hyperparameter value.\n```sh\narcee.hyperparam(key=\"YOUR-PARAM-KEY\", value=YOUR_PARAM_VALUE)\n```\nExample:\n```sh\narcee.hyperparam(\"EPOCHS\", 100)\n```\n\n## Tagging task run\nTo tag a run, use the `tag` method with the following parameters:\n- key (str, required): the tag name.\n- value (str | number, required): the tag value.\n```sh\narcee.tag(key=\"YOUR-TAG-KEY\", value=YOUR_TAG_VALUE)\n```\nExample:\n```sh\narcee.tag(\"Algorithm\", \"Linear Learn Algorithm\")\n```\n\n## Adding milestone\nTo add a milestone, use the `milestone` method with the following parameter:\n- name (str, required): the milestone name.\n```sh\narcee.milestone(name=\"YOUR-MILESTONE-NAME\")\n```\nExample:\n```sh\narcee.milestone(\"Download training data\")\n```\n\n## Adding stage\nTo add a stage, use the `stage` method with the following parameter:\n- name (str, required): the stage name.\n```sh\narcee.stage(name=\"YOUR-STAGE-NAME\")\n```\nExample:\n```sh\narcee.stage(\"preparing\")\n```\n\n## Logging datasets\nTo log a dataset, use the `dataset` method with the following parameters:\n- path (str, required): the dataset path.\n- name (str, optional): the dataset name.\n- description (str, optional): the dataset description.\n- labels (list, optional): the dataset labels.\n```sh\narcee.dataset(path=\"YOUR-DATASET-PATH\",\n name=\"YOUR-DATASET-NAME\",\n description=\"YOUR-DATASET-DESCRIPTION\",\n labels=[\"YOUR-DATASET-LABEL-1\", \"YOUR-DATASET-LABEL-2\"])\n```\nExample:\n```sh\narcee.dataset(\"https://s3/ml-bucket/datasets/training_dataset.csv\",\n name=\"Training dataset\",\n description=\"Training dataset (100k rows)\",\n labels=[\"training\", \"100k\"])\n```\n\n## Creating models\nTo create a model, use the `model` method with the following parameters:\n- key (str, required): the unique model key.\n- path (str, optional): the run model path.\n```sh\narcee.model(key=\"YOUR-MODEL-KEY\", path=\"YOUR-MODEL-PATH\")\n```\nExample:\n```sh\narcee.model(\"my_model\", \"/home/user/my_model\")\n```\n\n## Setting model version\nTo set a custom model version, use the `model_version` method with the following parameter:\n- version (str, required): the version name.\n```sh\narcee.model_version(version=\"YOUR-MODEL-VERSION\")\n```\nExample:\n```sh\narcee.model_version(\"1.2.3-release\")\n```\n\n## Setting model version alias\nTo set a model version alias, use the `model_version_alias` method with the following parameter:\n- alias (str, required): the alias name.\n```sh\narcee.model_version_alias(alias=\"YOUR-MODEL-VERSION-ALIAS\")\n```\nExample:\n```sh\narcee.model_version_alias(\"winner\")\n```\n\n## Setting model version tag\nTo add tags to a model version, use the `model_version_tag` method with the following parameters:\n- key (str, required): the tag name.\n- value (str | number, required): the tag value.\n```sh\narcee.model_version_tag(key=\"YOUR-MODEL-VERSION-TAG-KEY\", value=YOUR_MODEL_VERSION_TAG_VALUE)\n```\nExample:\n```sh\narcee.model_version_tag(\"env\", \"staging demo\")\n```\n\n## Creating artifacts\nTo create an artifact, use the `artifact` method with the following parameters:\n- path (str, required): the run artifact path.\n- name (str, optional): the artifact name.\n- description (str, optional): the artifact description.\n- tags (dict, optional): the artifact tags.\n```sh\narcee.artifact(path=\"YOUR-ARTIFACT-PATH\",\n name=\"YOUR-ARTIFACT-NAME\",\n description=\"YOUR-ARTIFACT-DESCRIPTION\",\n tags={\"YOUR-ARTIFACT-TAG-KEY\": YOUR_ARTIFACT_TAG_VALUE})\n```\nExample:\n```sh\narcee.artifact(\"https://s3/ml-bucket/artifacts/AccuracyChart.png\",\n name=\"Accuracy line chart\",\n description=\"The dependence of accuracy on the time\",\n tags={\"env\": \"staging\"})\n```\n\n## Setting artifact tag\nTo add a tag to an artifact, use the `artifact_tag` method with the following parameters:\n- path (str, required): the run artifact path.\n- key (str, required): the tag name.\n- value (str | number, required): the tag value.\n```sh\narcee.artifact_tag(path=\"YOUR-ARTIFACT-PATH\",\n key=\"YOUR-ARTIFACT-TAG-KEY\",\n value=YOUR_ARTIFACT_TAG_VALUE)\n```\nExample:\n```sh\narcee.artifact_tag(\"https://s3/ml-bucket/artifacts/AccuracyChart.png\",\n \"env\", \"staging demo\")\n```\n\n## Finishing task run\nTo finish a run, use the `finish` method.\n```sh\narcee.finish()\n```\n\n## Failing task run\nTo fail a run, use the `error` method.\n```sh\narcee.error()\n```\n",
"bugtrack_url": null,
"license": "\"Apache License 2.0\"",
"summary": "ML profiling tool for OptScale",
"version": "0.1.47",
"project_urls": {
"Homepage": "https://my.optscale.com/",
"Source": "https://github.com/hystax/optscale_arcee"
},
"split_keywords": [
"arcee",
" ml",
" optscale",
" finops",
" mlops"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ecda6a15993c1fae8b87b6d25fbd8e1514da3d02e90f7df7cb5d53df1665262b",
"md5": "0146a185b769021d7495dfb2cda041ad",
"sha256": "8309a352b28a3807bda81214be780f6f741cabda9cc568c91da58237e7a78880"
},
"downloads": -1,
"filename": "optscale_arcee-0.1.47.tar.gz",
"has_sig": false,
"md5_digest": "0146a185b769021d7495dfb2cda041ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.7",
"size": 23175,
"upload_time": "2024-11-20T11:21:38",
"upload_time_iso_8601": "2024-11-20T11:21:38.793943Z",
"url": "https://files.pythonhosted.org/packages/ec/da/6a15993c1fae8b87b6d25fbd8e1514da3d02e90f7df7cb5d53df1665262b/optscale_arcee-0.1.47.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 11:21:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hystax",
"github_project": "optscale_arcee",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "optscale-arcee"
}