Skip to content

Commit

Permalink
changed the while condition for the FSM deciding SW state
Browse files Browse the repository at this point in the history
  • Loading branch information
vrbanecd committed Jan 30, 2025
1 parent a94aa2a commit 717ca6e
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions teapot.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ async def storm_webdav_state(state, condition, sub):
"The state of the storm-webdav server for user %s is %s", user, state[user]
)

while not (state[user] == "STARTING" or state[user] == "RUNNING"):
while not (state[user] == "RUNNING"):
if state[user] == "NOT RUNNING":
state[user] = "STARTING"
condition.notify()
Expand All @@ -708,6 +708,7 @@ async def storm_webdav_state(state, condition, sub):
user,
state[user],
)
break
elif state[user] == "RUNNING":
async with app.state.state_lock:
app.state.session_state[user]["last_accessed"] = str(
Expand Down Expand Up @@ -817,48 +818,9 @@ async def storm_webdav_state(state, condition, sub):
return None, port, user

else:
running = False
loops = 0
while not running:
await anyio.sleep(1)
if loops >= STARTUP_TIMEOUT:
logger.debug(
"The webdav instance for user %s is not reachable after %d tries.",
user,
STARTUP_TIMEOUT,
)
async with condition:
if state[user] == "STARTING" or state[user] == "RUNNING":
state[user] = "NOT RUNNING"
async with app.state.state_lock:
app.state.session_state.pop(user)
logger.debug("The unresponsive webdav instance is removed.")
return None, -1, user
try:
context1 = ssl.create_default_context()
context1.load_verify_locations(
cafile=config["Storm-webdav"]["Storm-webdav_CA"]
)
resp = httpx.get(
"https://"
+ config["Storm-webdav"]["SERVER_ADDRESS"]
+ ":"
+ str(port)
+ "/",
verify=context1,
)
if resp.status_code >= 200:
running = True
except httpx.ConnectError:
loops += 1
logger.debug(
"Waiting for the webdav instance to start. This is check %d/%d.",
loops,
STARTUP_TIMEOUT,
)
async with condition:
async with app.state.state_lock:
port = app.state.session_state[user].get("port", None)
port = app.state.session_state[user].get("port")
logger.info(
"StoRM-WebDAV instance for %s is running on port %d", user, port
)
Expand Down

1 comment on commit 717ca6e

@vrbanecd
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
32 0 0 32 100 20.448226s

Passed Tests

Name ⏱️ Duration Suite
GET USER1 9.663 s Teapot-Tests
GET USER2 9.709 s Teapot-Tests
GET NO TOKEN 0.012 s Teapot-Tests
GET INVALID TOKEN 0.046 s Teapot-Tests
PUT REQUEST INVALID TOKEN 0.014 s Teapot-Tests
PUT REQUEST NO TOKEN 0.013 s Teapot-Tests
PUT REQUEST USER1 0.130 s Teapot-Tests
PUT REQUEST USER2 0.096 s Teapot-Tests
GET FILE USER1 0.082 s Teapot-Tests
GET FILE USER2 0.081 s Teapot-Tests
GET FILE NO TOKEN 0.011 s Teapot-Tests
GET FILE INVALID TOKEN 0.010 s Teapot-Tests
DELETE REQUEST USER1 0.039 s Teapot-Tests
DELETE REQUEST USER2 0.043 s Teapot-Tests
DELETE REQUEST INVALID TOKEN 0.011 s Teapot-Tests
DELETE REQUEST NO TOKEN 0.011 s Teapot-Tests
GET USER1 EXTRA_AREA 0.043 s Teapot-Tests
GET USER2 EXTRA_AREA 0.043 s Teapot-Tests
GET NO TOKEN EXTRA_AREA 0.011 s Teapot-Tests
GET INVALID TOKEN EXTRA_AREA 0.011 s Teapot-Tests
PUT REQUEST INVALID TOKEN EXTRA_AREA 0.011 s Teapot-Tests
PUT REQUEST NO TOKEN EXTRA_AREA 0.010 s Teapot-Tests
PUT REQUEST USER1 EXTRA_AREA 0.038 s Teapot-Tests
PUT REQUEST USER2 EXTRA_AREA 0.039 s Teapot-Tests
GET FILE USER1 EXTRA_AREA 0.059 s Teapot-Tests
GET FILE USER2 EXTRA_AREA 0.061 s Teapot-Tests
GET FILE NO TOKEN EXTRA_AREA 0.013 s Teapot-Tests
GET FILE INVALID TOKEN EXTRA_AREA 0.011 s Teapot-Tests
DELETE REQUEST USER1 EXTRA_AREA 0.063 s Teapot-Tests
DELETE REQUEST USER2 EXTRA_AREA 0.044 s Teapot-Tests
DELETE REQUEST INVALID TOKEN EXTRA_AREA 0.011 s Teapot-Tests
DELETE REQUEST NO TOKEN EXTRA_AREA 0.011 s Teapot-Tests

Please sign in to comment.