Skip to content

Commit f7af64c

Browse files
authored
Merge pull request #213 from Exabyte-io/update/SOF-7324
Update/SOF-7324 fix last 2 tests
2 parents 7043893 + b4fc580 commit f7af64c

File tree

2 files changed

+54
-24
lines changed

2 files changed

+54
-24
lines changed

examples/system/get_authentication_params.ipynb

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,53 @@
4343
]
4444
},
4545
{
46+
"metadata": {},
4647
"cell_type": "code",
47-
"execution_count": null,
48-
"metadata": {
49-
"cellView": "form"
50-
},
51-
"outputs": [],
5248
"source": [
5349
"# @title Authorization Form\n",
54-
"USERNAME = \"YOUR_USERNAME\" # @param {type:\"string\"}\n",
50+
"USERNAME = \"YOUR_USERNAME\" # @param {type:\"string\"}"
51+
],
52+
"outputs": [],
53+
"execution_count": null
54+
},
55+
{
56+
"metadata": {},
57+
"cell_type": "code",
58+
"source": [
59+
"import sys\n",
5560
"\n",
61+
"# Get username if not set in parameters\n",
62+
"if USERNAME == \"YOUR_USERNAME\":\n",
63+
" if sys.platform == \"emscripten\":\n",
64+
" USERNAME = await input(\"Please enter username: \")\n",
65+
" else:\n",
66+
" USERNAME = input(\"Please enter username: \")\n",
67+
"print(f\"Using username: {USERNAME}\")"
68+
],
69+
"outputs": [],
70+
"execution_count": null
71+
},
72+
{
73+
"metadata": {},
74+
"cell_type": "code",
75+
"source": [
76+
"# Get password\n",
5677
"# avoid storing password in plaintext\n",
5778
"from getpass import getpass\n",
5879
"\n",
80+
"if sys.platform == \"emscripten\":\n",
81+
" PASSWORD = await getpass(\"Please enter password: \")\n",
82+
"else:\n",
83+
" PASSWORD = getpass(\"Please enter password: \")"
84+
],
85+
"outputs": [],
86+
"execution_count": null
87+
},
88+
{
89+
"metadata": {},
90+
"cell_type": "code",
91+
"source": [
5992
"import os\n",
60-
"import sys\n",
6193
"\n",
6294
"if \"COLAB_JUPYTER_IP\" in os.environ:\n",
6395
" !GIT_BRANCH=\"dev\"; export GIT_BRANCH; curl -s \"https://raw.githubusercontent.com/Exabyte-io/api-examples/${GIT_BRANCH}/scripts/env.sh\" | bash\n",
@@ -78,11 +110,10 @@
78110
" await micropip.install(\"mat3ra-api-examples\", deps=False)\n",
79111
" from utils.jupyterlite import install_packages\n",
80112
"\n",
81-
" await install_packages(\"api_examples\")\n",
82-
" PASSWORD = await getpass(\"Please enter password: \")\n",
83-
"else:\n",
84-
" PASSWORD = getpass(\"Please enter password: \")"
85-
]
113+
" await install_packages(\"api_examples\")"
114+
],
115+
"outputs": [],
116+
"execution_count": null
86117
},
87118
{
88119
"attachments": {},
@@ -94,15 +125,15 @@
94125
},
95126
{
96127
"cell_type": "code",
97-
"execution_count": null,
98128
"metadata": {},
99-
"outputs": [],
100129
"source": [
101130
"from utils.settings import HOST, PORT, VERSION, SECURE\n",
102131
"from utils.generic import display_JSON\n",
103132
"\n",
104133
"from exabyte_api_client.endpoints.login import LoginEndpoint"
105-
]
134+
],
135+
"outputs": [],
136+
"execution_count": null
106137
},
107138
{
108139
"attachments": {},
@@ -114,13 +145,13 @@
114145
},
115146
{
116147
"cell_type": "code",
117-
"execution_count": null,
118148
"metadata": {},
119-
"outputs": [],
120149
"source": [
121150
"endpoint = LoginEndpoint(HOST, PORT, USERNAME, PASSWORD, VERSION, SECURE)\n",
122151
"auth_params = endpoint.login()"
123-
]
152+
],
153+
"outputs": [],
154+
"execution_count": null
124155
},
125156
{
126157
"attachments": {},
@@ -134,16 +165,16 @@
134165
},
135166
{
136167
"cell_type": "code",
137-
"execution_count": null,
138168
"metadata": {
139169
"pycharm": {
140170
"name": "#%%\n"
141171
}
142172
},
143-
"outputs": [],
144173
"source": [
145174
"display_JSON(auth_params)"
146-
]
175+
],
176+
"outputs": [],
177+
"execution_count": null
147178
}
148179
],
149180
"metadata": {

examples/workflow/qe_scf_calculation.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
"id": "62f59cb7",
4545
"metadata": {},
4646
"source": [
47-
"from examples.workflow.get_workflows import QUERY\n",
48-
"\n",
4947
"# @title Authorization Form\n",
5048
"ACCOUNT_ID = \"ACCOUNT_ID\" # @param {type:\"string\"}\n",
5149
"AUTH_TOKEN = \"AUTH_TOKEN\" # @param {type:\"string\"}\n",
@@ -374,7 +372,8 @@
374372
"len_energy = len(\"total energy\")\n",
375373
"for line in output_file.split(\"\\n\"):\n",
376374
" if line.strip().lstrip(\"!\")[:len_energy] == \"total energy\":\n",
377-
" energy.append(float(line.split(\"=\")[1].rstrip(\"Ry\")))"
375+
" energy.append(float(line.split(\"=\")[1].rstrip(\"Ry\")))\n",
376+
"print(\"Total energy (Ry):\", energy[-1])"
378377
],
379378
"outputs": [],
380379
"execution_count": null

0 commit comments

Comments
 (0)