Skip to content

Commit 1a0240e

Browse files
authored
Switch to sci-react-ui for header, add login flow (#13)
1 parent 89391fd commit 1a0240e

File tree

13 files changed

+274
-236
lines changed

13 files changed

+274
-236
lines changed

web-conexs-api/src/slurm_submission_service/submitter.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,13 @@ def run_update():
249249
r = requests.get(url_jobs, headers=headers)
250250

251251
if r.status_code != 200:
252-
print(r.status_code)
253-
raise Exception("Response not successful")
252+
raise Exception(f"Response not successful: Status code {r.status_code}")
254253

255254
response = r.json()
256255
jobs = response["jobs"]
257256

258257
job_map = {}
259258

260-
# print(SLURM_USER)
261-
262-
# for j in jobs:
263-
# print(j["account"])
264-
265259
for j in jobs:
266260
if j["account"] == SLURM_USER:
267261
job_map[j["job_id"]] = {"state": j["job_state"][0]}
@@ -294,18 +288,9 @@ def run_update():
294288
a.status = SimulationStatus.failed
295289
update_simulation(session, a)
296290

297-
# try:
298-
# next(sessions)
299-
# except StopIteration:
300-
# pass
301-
302-
# print(sims)
303-
304291

305292
def test_read():
306293
with contextmanager(get_session)() as session:
307-
# sessions = get_session()
308-
# session = next(sessions)
309294
sims = get_submitted_simulations(session)
310295
for sim in sims:
311296
if sim.simulation_type_id == 1:
@@ -314,9 +299,13 @@ def test_read():
314299

315300

316301
def main():
317-
# test_read()
318302
print("Running main loop")
319303
while True:
320-
run_update()
304+
try:
305+
run_update()
306+
except KeyboardInterrupt:
307+
logger.info("Stopped with keyboard")
308+
except Exception:
309+
logger.exception("Error in update loop")
321310
time.sleep(10)
322311
print("Loop iteration complete")

web-conexs-client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"dependencies": {
1414
"3dmol": "^2.4.2",
15+
"@diamondlightsource/sci-react-ui": "^0.1.0",
1516
"@emotion/react": "^11.14.0",
1617
"@emotion/styled": "^11.14.0",
1718
"@h5web/lib": "^13.0.0",
@@ -33,6 +34,7 @@
3334
"@testing-library/jest-dom": "^6.6.3",
3435
"@testing-library/react": "^16.3.0",
3536
"@testing-library/user-event": "^14.6.1",
37+
"@types/node": "^22.15.29",
3638
"@types/react": "^18.3.18",
3739
"@types/react-dom": "^18.3.5",
3840
"@vitejs/plugin-react": "^4.3.4",

web-conexs-client/pnpm-lock.yaml

Lines changed: 79 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)