Skip to content
Snippets Groups Projects

Add helper notebooks

Merged Charles Daniels requested to merge dschuck/aos_maap_dps:notebooks into main
5 files
+ 758
1
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 60
0
%% Cell type:markdown id:8a2d8d86-2187-44d7-9f44-d5e6583622b5 tags:
# Register the Algorithm
%% Cell type:code id:3561be3b-2600-4075-b177-0d79c78e334a tags:
``` python
import os
import os.path
import sys
import yaml
from maap.maap import MAAP
```
%% Cell type:markdown id:eb2e6f45-47cb-48c5-9fe2-feccc07d5c17 tags:
## Create MAAP Instance for Initiating Registration
%% Cell type:code id:38f966fd-9f1e-4f57-a930-14c0f471ea19 tags:
``` python
maap = MAAP()
```
%% Cell type:markdown id:ca846531-802e-4f23-8e5d-df84b812a590 tags:
## Initiate a Registration Process
Running the following cell will _initiate_ a registration process to register the algorithm configured in the file `algorith_config.yaml` at the root of this repository. If _initiation_ succeeds, the URL of the initiated registration _process_ will appear in the cell output, otherwise an error message will appear.
If an error appears in the cell output, it likely indicates that there is a problem with the DPS itself that is preventing the initiation of any registration processes, and you should use Slack to request assistance.
If a registration process URL appears in the cell output. Open a browser to the given URL to check the status of the regsitration process. This process will likely take 5-6 minutes to complete successfully, but might fail much more quickly than that.
When the registration process completes successfully will you be able to run the new version of the registered algorithm.
When the registration process fails, it might be a transient problem, so you may simply need to rerun the following cell to get past the transient error. If failure of registration processes persists after 3 or 4 attempts, use Slack to request assistance, as there may be a problem with DPS.
%% Cell type:code id:eb743993-1098-497e-bc17-94bcc81b1eaa tags:
``` python
base_dir = os.path.dirname(os.getcwd())
algorithm_config_yaml = os.path.join(base_dir, "algorithm_config.yaml")
with open(algorithm_config_yaml) as f:
algorithm_config = yaml.safe_load(f)
algorithm_name = algorithm_config["algorithm_name"]
algorithm_version = algorithm_config["algorithm_version"]
if response := maap.register_algorithm_from_yaml_file(algorithm_config_yaml):
job_web_url = response.json()["message"]["job_web_url"]
print(
f"Initiated algorithm registration for {algorithm_name}:{algorithm_version}."
f" Check progress at {job_web_url}."
)
else:
print("ERROR:", response.json()["message"], file=sys.stderr)
```
Loading