Skip to content

Commit

Permalink
OS-8000. Updated README.md (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-hystax authored Nov 20, 2024
1 parent 77571e3 commit dfe6049
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 31 deletions.
79 changes: 49 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,56 @@ import optscale_arcee as arcee
```

## Initialization
To initialize the arcee collector you need to provide a profiling token and a task key for which you want to collect data.
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, task_key):
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
```
Example:

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"):
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, task_key)
arcee.init(token="YOUR-PROFILING-TOKEN", task_key="YOUR-TASK-KEY")
# some code
arcee.finish()
# or in case of error
arcee.error()
```

To use a custom endpoint and enable/disable SSL checks (enable self-signed SSL certificates support):
```sh
with arcee.init(token, task_key, endpoint_url="https://my.custom.endpoint:443/arcee/v2", ssl=False):
# some code
```
Arcee daemon process periodically sends hardware and process data. The default heartbeat period is 1 second. However, arcee can be initialized with a custom period:
```sh
with arcee.init(token, task_key, period=5):
# some code
```

## 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({ "metric_key_1": value_1, "metric_key_2": value_2 })
arcee.send({"YOUR-METRIC-1-KEY": YOUR_METRIC_1_VALUE, "YOUR-METRIC-2-KEY": YOUR_METRIC_2_VALUE})
```
Example:
```sh
Expand All @@ -68,7 +79,7 @@ To add hyperparameters, use the `hyperparam` method with the following parameter
- key (str, required): the hyperparameter name.
- value (str | number, required): the hyperparameter value.
```sh
arcee.hyperparam(key, value)
arcee.hyperparam(key="YOUR-PARAM-KEY", value=YOUR_PARAM_VALUE)
```
Example:
```sh
Expand All @@ -80,7 +91,7 @@ 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, value)
arcee.tag(key="YOUR-TAG-KEY", value=YOUR_TAG_VALUE)
```
Example:
```sh
Expand All @@ -91,7 +102,7 @@ arcee.tag("Algorithm", "Linear Learn Algorithm")
To add a milestone, use the `milestone` method with the following parameter:
- name (str, required): the milestone name.
```sh
arcee.milestone(name)
arcee.milestone(name="YOUR-MILESTONE-NAME")
```
Example:
```sh
Expand All @@ -102,7 +113,7 @@ arcee.milestone("Download training data")
To add a stage, use the `stage` method with the following parameter:
- name (str, required): the stage name.
```sh
arcee.stage(name)
arcee.stage(name="YOUR-STAGE-NAME")
```
Example:
```sh
Expand All @@ -116,7 +127,10 @@ To log a dataset, use the `dataset` method with the following parameters:
- description (str, optional): the dataset description.
- labels (list, optional): the dataset labels.
```sh
arcee.dataset(path, name, description, labels)
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
Expand All @@ -131,7 +145,7 @@ 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, path)
arcee.model(key="YOUR-MODEL-KEY", path="YOUR-MODEL-PATH")
```
Example:
```sh
Expand All @@ -142,7 +156,7 @@ arcee.model("my_model", "/home/user/my_model")
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)
arcee.model_version(version="YOUR-MODEL-VERSION")
```
Example:
```sh
Expand All @@ -153,7 +167,7 @@ arcee.model_version("1.2.3-release")
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)
arcee.model_version_alias(alias="YOUR-MODEL-VERSION-ALIAS")
```
Example:
```sh
Expand All @@ -163,9 +177,9 @@ 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, required): the tag value.
- value (str | number, required): the tag value.
```sh
arcee.model_version_tag(key, value)
arcee.model_version_tag(key="YOUR-MODEL-VERSION-TAG-KEY", value=YOUR_MODEL_VERSION_TAG_VALUE)
```
Example:
```sh
Expand All @@ -179,7 +193,10 @@ To create an artifact, use the `artifact` method with the following parameters:
- description (str, optional): the artifact description.
- tags (dict, optional): the artifact tags.
```sh
arcee.artifact(path, name, description, tags)
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
Expand All @@ -193,9 +210,11 @@ arcee.artifact("https://s3/ml-bucket/artifacts/AccuracyChart.png",
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, required): the tag value.
- value (str | number, required): the tag value.
```sh
arcee.artifact_tag(path, key, value)
arcee.artifact_tag(path="YOUR-ARTIFACT-PATH",
key="YOUR-ARTIFACT-TAG-KEY",
value=YOUR_ARTIFACT_TAG_VALUE)
```
Example:
```sh
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# setup.cfg
[metadata]
name = optscale_arcee
version = 0.1.46
version = 0.1.47
author = Hystax
description = ML profiling tool for OptScale
long_description = file: README.md
Expand Down

0 comments on commit dfe6049

Please sign in to comment.