Skip to content

Commit

Permalink
feat: adding algorithm yaml to repo (#4)
Browse files Browse the repository at this point in the history
* feat: adding algorithm yaml to repo

* feat: correct base image url, notebook for registering and testing

* fix: fill in env.yml for use with base

* fix: update to pangeo image
  • Loading branch information
wildintellect authored Nov 22, 2024
1 parent f305da8 commit 7ba79db
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 0 deletions.
13 changes: 13 additions & 0 deletions algorithm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
algorithm_description: Test alg for S1 access at ASF
algorithm_name: AFSDAACS3-s1
algorithm_version: 0.1.1
build_command: s1-example/build.sh
disk_space: 10GB
docker_container_url: mas.maap-project.org/root/maap-workspaces/base_images/pangeo:v4.1.1
inputs:
config: []
file: []
positional: []
queue: maap-dps-sandbox
repository_url: https://github.com/MAAP-Project/s1-example.git
run_command: s1-example/run.sh
3 changes: 3 additions & 0 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ channels:
- defaults
dependencies:
- boto3
- pip
- pip:
- maap-py
232 changes: 232 additions & 0 deletions notebook/register-algorithm.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "04afeb47-be73-4418-ac86-4b174292a65e",
"metadata": {},
"outputs": [],
"source": [
"from maap.maap import MAAP\n",
"maap = MAAP(maap_host='api.maap-project.org')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3cc5032e-a79e-4cbd-b51b-e4cb6e74c822",
"metadata": {},
"outputs": [],
"source": [
"#registration via code example\n",
"response = maap.register_algorithm_from_yaml_file(\"../algorithm.yml\")\n",
"print(response.text)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "524a5e6a-a215-4610-9c7f-b358434ef6d5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'job_id': '6174249a-ceb5-4712-b913-70ec4660f20e', 'status': 'success', 'machine_type': None, 'architecture': None, 'machine_memory_size': None, 'directory_size': None, 'operating_system': None, 'job_start_time': None, 'job_end_time': None, 'job_duration_seconds': None, 'cpu_usage': None, 'cache_usage': None, 'mem_usage': None, 'max_mem_usage': None, 'swap_usage': None, 'read_io_stats': None, 'write_io_stats': None, 'sync_io_stats': None, 'async_io_stats': None, 'total_io_stats': None, 'error_details': None, 'response_code': 200, 'outputs': []}"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"jobs = maap.submitJob(identifier=\"sixth\",\n",
" algo_id=\"ASFDAACS3Test\",\n",
" version=\"main\",\n",
" username=\"alexdevseed\",\n",
" queue=\"maap-dps-worker-8gb\",\n",
" )\n",
"jobs"
]
},
{
"cell_type": "markdown",
"id": "d75f4d92-ebc4-40d3-a672-f8dba5169234",
"metadata": {},
"source": [
"# Job stuck in the Queue\n",
"maap.getJobStatus('d2d4a8aa-7a71-4e8a-ad3d-94014a23f7f9')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "f24e2b69-827d-4b30-8dd2-1bd50eadae3d",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'6174249a-ceb5-4712-b913-70ec4660f20e'"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"jobs.id"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "6b8f306f-06c3-40c3-bd55-1885bc1cb21b",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Succeeded'"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"maap.getJobStatus(\"6174249a-ceb5-4712-b913-70ec4660f20e\")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "6aee209c-5806-4161-a697-174e530708bc",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['http://maap-ops-workspace.s3-website-us-west-2.amazonaws.com/alexdevseed/dps_output/ASFDAACS3Test/main/sixth/2024/01/08/12/23/55/196198',\n",
" 's3://s3.us-west-2.amazonaws.com:80/maap-ops-workspace/alexdevseed/dps_output/ASFDAACS3Test/main/sixth/2024/01/08/12/23/55/196198',\n",
" 'https://s3.console.aws.amazon.com/s3/buckets/maap-ops-workspace/alexdevseed/dps_output/ASFDAACS3Test/main/sixth/2024/01/08/12/23/55/196198/?region=us-east-1&tab=overview']"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"maap.getJobResult(\"6174249a-ceb5-4712-b913-70ec4660f20e\")"
]
},
{
"cell_type": "markdown",
"id": "b73efe18-bbe6-4a1f-a3f1-094560e0f263",
"metadata": {
"tags": []
},
"source": [
"## Confirm the Data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f7fd369-68d3-4d23-b073-6ca24a940e27",
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"xr.open(my-private-bucket/dps_output/ASFDAACS3Test/main/sixth/2024/01/08/12/23/55/196198/S1A_IW_SLC__1SDV_20230601T015222_20230601T015249_048786_05DDF3_C29B.zip)"
]
},
{
"cell_type": "markdown",
"id": "449c661d-8fa7-4ffe-a918-8f551b414a30",
"metadata": {},
"source": [
"## Cancel bad jobs\n",
"\n",
"Doesn't seem to work "
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "108fa7b0-8cd6-4df5-acdf-f8c2815c93b7",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'<wps:StatusInfo xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:schemaLocation=\"http://schemas.opengis.net/wps/2.0/wps.xsd\" xmlns:ows=\"http://www.opengis.net/ows/2.0\"><wps:JobID>d2d4a8aa-7a71-4e8a-ad3d-94014a23f7f9</wps:JobID><wps:Status>Accepted</wps:Status></wps:StatusInfo>'"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"maap.cancelJob(\"d2d4a8aa-7a71-4e8a-ad3d-94014a23f7f9\")"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "39a541af-d412-4f80-b19c-24d41e1e87d5",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'<wps:StatusInfo xmlns:wps=\"http://www.opengis.net/wps/2.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:schemaLocation=\"http://schemas.opengis.net/wps/2.0/wps.xsd\" xmlns:ows=\"http://www.opengis.net/ows/2.0\"><wps:JobID>78ff94dc-e50a-4bbe-acfd-a8ab3fbde90b</wps:JobID><wps:Status>Accepted</wps:Status></wps:StatusInfo>'"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"maap.cancelJob(\"78ff94dc-e50a-4bbe-acfd-a8ab3fbde90b\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:pangeo] *",
"language": "python",
"name": "conda-env-pangeo-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 7ba79db

Please sign in to comment.