Skip to content

Commit

Permalink
Merge pull request #73 from Exabyte-io/feature/SOF-6654-2
Browse files Browse the repository at this point in the history
Feature/SOF-6654-2: move `utils` out of `examples`
  • Loading branch information
mrakitin committed Jun 22, 2023
2 parents 14fd2a8 + b183116 commit 020dd7e
Show file tree
Hide file tree
Showing 34 changed files with 570 additions and 659 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ examples/material/get_materials_by_formula.ipynb !filter !diff !merge text
examples/material/import_materials_from_materialsproject.ipynb !filter !diff !merge text
examples/material/import_materials_from_poscar.ipynb !filter !diff !merge text
examples/system/get_authentication_params.ipynb !filter !diff !merge text
examples/workflow/get_workflows.ipynb !filter !diff !merge text
images/*.png filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ In order to run or edit the examples:

1. Assert an existing Mat3ra.com account. Examples require an account to run. New users can register [here](https://platform.mat3ra.com/register) to obtain one.

2. Open [settings](examples/settings.json) and adjust it to provide the API authentication parameters. See the [corresponding example](examples/system/get_authentication_params.ipynb) to learn how to obtain the authentication parameters.
2. Open [settings](utils/settings.json) and adjust it to provide the API authentication parameters. See the [corresponding example](examples/system/get_authentication_params.ipynb) to learn how to obtain the authentication parameters.

3. Open the desired example notebook, adjust it as necessary and run. One can speed up the notebooks execution after running the [Get Authentication Params](examples/system/get_authentication_params.ipynb) one by reusing the kernel from the first notebook.

Expand Down
88 changes: 44 additions & 44 deletions examples/job/create_and_submit_job.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"\n",
"ORGANIZATION_ID - Authentication parameter needed for when working with collaborative accounts https://docs.mat3ra.com/collaboration/organizations/overview/\n",
"\n",
"> <span style=\"color: orange\">**NOTE**</span>: If you are running this notebook from Jupyter, the variables ACCOUNT_ID, AUTH_TOKEN, MATERIALS_PROJECT_API_KEY, and ORGANIZATION_ID should be set in the file [settings.json](../settings.json) if you need to use these variables. To obtain API token parameters, please see the following link to the documentation explaining how to get them: https://docs.mat3ra.com/accounts/ui/preferences/api/"
"> <span style=\"color: orange\">**NOTE**</span>: If you are running this notebook from Jupyter, the variables ACCOUNT_ID, AUTH_TOKEN, MATERIALS_PROJECT_API_KEY, and ORGANIZATION_ID should be set in the file [settings.json](../../utils/settings.json) if you need to use these variables. To obtain API token parameters, please see the following link to the documentation explaining how to get them: https://docs.mat3ra.com/accounts/ui/preferences/api/"
]
},
{
Expand All @@ -55,10 +55,10 @@
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2023-06-21T01:34:29.145070Z",
"iopub.status.busy": "2023-06-21T01:34:29.144039Z",
"iopub.status.idle": "2023-06-21T01:34:29.146795Z",
"shell.execute_reply": "2023-06-21T01:34:29.147519Z"
"iopub.execute_input": "2023-06-22T04:18:02.244811Z",
"iopub.status.busy": "2023-06-22T04:18:02.243791Z",
"iopub.status.idle": "2023-06-22T04:18:02.246513Z",
"shell.execute_reply": "2023-06-22T04:18:02.247480Z"
},
"id": "BCOL6ona3sR6",
"outputId": "e2ee53a4-5013-4730-c074-54ba11b381fd"
Expand Down Expand Up @@ -90,10 +90,10 @@
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:29.153958Z",
"iopub.status.busy": "2023-06-21T01:34:29.152493Z",
"iopub.status.idle": "2023-06-21T01:34:29.250442Z",
"shell.execute_reply": "2023-06-21T01:34:29.251000Z"
"iopub.execute_input": "2023-06-22T04:18:02.252809Z",
"iopub.status.busy": "2023-06-22T04:18:02.252086Z",
"iopub.status.idle": "2023-06-22T04:18:02.316228Z",
"shell.execute_reply": "2023-06-22T04:18:02.316813Z"
},
"id": "QRLd1WW23sR6"
},
Expand All @@ -102,14 +102,14 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/exabyte/.pyenv/versions/3.8.6/lib/python3.8/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.5) or chardet (3.0.4) doesn't match a supported version!\n",
"/Users/exabyte/src/api-examples/.env/lib/python3.8/site-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.5) or chardet (3.0.4) doesn't match a supported version!\n",
" warnings.warn(\"urllib3 ({}) or chardet ({}) doesn't match a supported \"\n"
]
}
],
"source": [
"from examples.settings import ENDPOINT_ARGS, ACCOUNT_ID\n",
"from examples.utils.generic import display_JSON\n",
"from utils.settings import ENDPOINT_ARGS, ACCOUNT_ID\n",
"from utils.generic import display_JSON\n",
"\n",
"from exabyte_api_client.endpoints.jobs import JobEndpoints\n",
"from exabyte_api_client.endpoints.materials import MaterialEndpoints\n",
Expand All @@ -131,10 +131,10 @@
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:29.257128Z",
"iopub.status.busy": "2023-06-21T01:34:29.256313Z",
"iopub.status.idle": "2023-06-21T01:34:29.258817Z",
"shell.execute_reply": "2023-06-21T01:34:29.258223Z"
"iopub.execute_input": "2023-06-22T04:18:02.321607Z",
"iopub.status.busy": "2023-06-22T04:18:02.320826Z",
"iopub.status.idle": "2023-06-22T04:18:02.323617Z",
"shell.execute_reply": "2023-06-22T04:18:02.323034Z"
},
"id": "IEPURdwU3sR7"
},
Expand All @@ -160,10 +160,10 @@
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:29.263271Z",
"iopub.status.busy": "2023-06-21T01:34:29.262475Z",
"iopub.status.idle": "2023-06-21T01:34:29.264713Z",
"shell.execute_reply": "2023-06-21T01:34:29.265250Z"
"iopub.execute_input": "2023-06-22T04:18:02.327445Z",
"iopub.status.busy": "2023-06-22T04:18:02.326726Z",
"iopub.status.idle": "2023-06-22T04:18:02.328658Z",
"shell.execute_reply": "2023-06-22T04:18:02.329428Z"
},
"id": "lYUKdszw3sR8"
},
Expand All @@ -189,10 +189,10 @@
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:29.271853Z",
"iopub.status.busy": "2023-06-21T01:34:29.270403Z",
"iopub.status.idle": "2023-06-21T01:34:30.694705Z",
"shell.execute_reply": "2023-06-21T01:34:30.695286Z"
"iopub.execute_input": "2023-06-22T04:18:02.335860Z",
"iopub.status.busy": "2023-06-22T04:18:02.335089Z",
"iopub.status.idle": "2023-06-22T04:18:03.720508Z",
"shell.execute_reply": "2023-06-22T04:18:03.721042Z"
},
"id": "qGTJOZDa3sR9"
},
Expand Down Expand Up @@ -223,10 +223,10 @@
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:30.700446Z",
"iopub.status.busy": "2023-06-21T01:34:30.699624Z",
"iopub.status.idle": "2023-06-21T01:34:30.701534Z",
"shell.execute_reply": "2023-06-21T01:34:30.702006Z"
"iopub.execute_input": "2023-06-22T04:18:03.725926Z",
"iopub.status.busy": "2023-06-22T04:18:03.725121Z",
"iopub.status.idle": "2023-06-22T04:18:03.727140Z",
"shell.execute_reply": "2023-06-22T04:18:03.727650Z"
},
"id": "BHQnJpvR3sR-"
},
Expand Down Expand Up @@ -261,10 +261,10 @@
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-21T01:34:30.707015Z",
"iopub.status.busy": "2023-06-21T01:34:30.706276Z",
"iopub.status.idle": "2023-06-21T01:34:33.387986Z",
"shell.execute_reply": "2023-06-21T01:34:33.388992Z"
"iopub.execute_input": "2023-06-22T04:18:03.732980Z",
"iopub.status.busy": "2023-06-22T04:18:03.732224Z",
"iopub.status.idle": "2023-06-22T04:18:07.303423Z",
"shell.execute_reply": "2023-06-22T04:18:07.304102Z"
},
"id": "xaSRHY4j3sR-"
},
Expand Down Expand Up @@ -294,10 +294,10 @@
"base_uri": "https://localhost:8080/"
},
"execution": {
"iopub.execute_input": "2023-06-21T01:34:33.394825Z",
"iopub.status.busy": "2023-06-21T01:34:33.393790Z",
"iopub.status.idle": "2023-06-21T01:34:34.077525Z",
"shell.execute_reply": "2023-06-21T01:34:34.078311Z"
"iopub.execute_input": "2023-06-22T04:18:07.308963Z",
"iopub.status.busy": "2023-06-22T04:18:07.308201Z",
"iopub.status.idle": "2023-06-22T04:18:07.976159Z",
"shell.execute_reply": "2023-06-22T04:18:07.976722Z"
},
"id": "dJbjoBoJ3sR_",
"outputId": "5f2ee6e2-edc1-450c-9eb1-4a29a83a12fb"
Expand All @@ -308,7 +308,7 @@
"output_type": "stream",
"text": [
"{\n",
" \"_id\": \"neBrw59Lr36QXt3kq\",\n",
" \"_id\": \"Zsi9CahtHuso33447\",\n",
" \"name\": \"TEST JOB\",\n",
" \"owner\": {\n",
" \"_id\": \"8TX5q8Eenb5a5fqCK\",\n",
Expand All @@ -323,7 +323,7 @@
" \"notify\": \"n\",\n",
" \"cluster\": {\n",
" \"fqdn\": \"master-production-20160630-cluster-001.exabyte.io\",\n",
" \"jid\": \"90931.master-production-20160630-cluster-001.exabyte.io\"\n",
" \"jid\": \"90944.master-production-20160630-cluster-001.exabyte.io\"\n",
" },\n",
" \"timeLimitType\": \"per single attempt\",\n",
" \"isRestartable\": true,\n",
Expand Down Expand Up @@ -746,25 +746,25 @@
" \"isDefault\": false,\n",
" \"statusTrack\": [\n",
" {\n",
" \"trackedAt\": 1687311271738,\n",
" \"trackedAt\": 1687407484678,\n",
" \"status\": \"pre-submission\"\n",
" },\n",
" {\n",
" \"trackedAt\": 1687311273505,\n",
" \"trackedAt\": 1687407487273,\n",
" \"status\": \"submitted\"\n",
" }\n",
" ],\n",
" \"isEntitySet\": false,\n",
" \"createdAt\": \"2023-06-21T01:34:31.738Z\",\n",
" \"createdAt\": \"2023-06-22T04:18:04.678Z\",\n",
" \"createdBy\": \"0\",\n",
" \"friendlySlugs\": {\n",
" \"slug\": {\n",
" \"base\": \"test-job\",\n",
" \"index\": 11\n",
" \"index\": 13\n",
" }\n",
" },\n",
" \"slug\": \"test-job-11\",\n",
" \"updatedAt\": \"2023-06-21T01:34:33.810Z\",\n",
" \"slug\": \"test-job-13\",\n",
" \"updatedAt\": \"2023-06-22T04:18:07.691Z\",\n",
" \"updatedBy\": \"0\"\n",
"}\n"
]
Expand Down
10 changes: 5 additions & 5 deletions examples/job/create_and_submit_job.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding: utf-8

# <a href="https://colab.research.google.com/github/Exabyte-io/api-examples/blob/bugfix/SOF-5578-WIP/examples/job/create_and_submit_job.ipynb" target="_parent">
# <a href="https://colab.research.google.com/github/Exabyte-io/api-examples/blob/dev/examples/job/create_and_submit_job.ipynb" target="_parent">
# <img alt="Open in Google Colab" src="https://user-images.githubusercontent.com/20477508/128780728-491fea90-9b23-495f-a091-11681150db37.jpeg" width="150" border="0">
# </a>

Expand All @@ -21,7 +21,7 @@
#
# ORGANIZATION_ID - Authentication parameter needed for when working with collaborative accounts https://docs.mat3ra.com/collaboration/organizations/overview/
#
# > <span style="color: orange">**NOTE**</span>: If you are running this notebook from Jupyter, the variables ACCOUNT_ID, AUTH_TOKEN, MATERIALS_PROJECT_API_KEY, and ORGANIZATION_ID should be set in the file [settings.json](../settings.json) if you need to use these variables. To obtain API token parameters, please see the following link to the documentation explaining how to get them: https://docs.mat3ra.com/accounts/ui/preferences/api/
# > <span style="color: orange">**NOTE**</span>: If you are running this notebook from Jupyter, the variables ACCOUNT_ID, AUTH_TOKEN, MATERIALS_PROJECT_API_KEY, and ORGANIZATION_ID should be set in the file [settings.json](../../utils/settings.json) if you need to use these variables. To obtain API token parameters, please see the following link to the documentation explaining how to get them: https://docs.mat3ra.com/accounts/ui/preferences/api/

# In[ ]:

Expand All @@ -43,14 +43,14 @@
)
)

get_ipython().system('GIT_BRANCH="bugfix/SOF-5578-WIP"; export GIT_BRANCH; curl -s "https://raw.githubusercontent.com/Exabyte-io/api-examples/${GIT_BRANCH}/scripts/env.sh" | bash')
get_ipython().system('GIT_BRANCH="dev"; export GIT_BRANCH; curl -s "https://raw.githubusercontent.com/Exabyte-io/api-examples/${GIT_BRANCH}/scripts/env.sh" | bash')


# In[ ]:


from examples.settings import ENDPOINT_ARGS, ACCOUNT_ID
from examples.utils.generic import display_JSON
from utils.settings import ENDPOINT_ARGS, ACCOUNT_ID
from utils.generic import display_JSON

from exabyte_api_client.endpoints.jobs import JobEndpoints
from exabyte_api_client.endpoints.materials import MaterialEndpoints
Expand Down
Loading

0 comments on commit 020dd7e

Please sign in to comment.