Skip to content

Commit

Permalink
feat: all session should be able to provide setup states
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed Feb 21, 2023
1 parent 1f6e0b2 commit 6f78534
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions backend/capellacollab/sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from capellacollab.config import config
from capellacollab.sessions.models import DatabaseSession
from capellacollab.sessions.operators import get_operator
from capellacollab.sessions.schema import WorkspaceType

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -72,14 +71,12 @@ def _get_last_seen(idletime: int | float) -> str:
def _determine_session_state(session: DatabaseSession) -> str:
state = get_operator().get_session_state(session.id)

if session.type == WorkspaceType.READONLY:
if state in ("Started", "BackOff"):
try:
if state in ("Started", "BackOff"):
logs = get_operator().get_session_logs(session.id).splitlines()
for line in logs:
res = re.search(r"^---(.*?)---$", line)
if res:
state = res.group(1)
logs = get_operator().get_session_logs(session.id)
res = re.search(r"(?s:.*)^---(.*?)---$", logs, re.MULTILINE)
if res:
return res.group(1)
except Exception:
log.exception("Could not parse log")
return state
2 changes: 1 addition & 1 deletion frontend/src/app/sessions/service/session.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class SessionService {
success = true;
break;

// Cases for readonly containers
// Cases for startingfrontend/src/app/sessions/service/session.service.ts containers
case 'START_LOAD_MODEL':
text = 'Modelloading started';
css = 'warning';
Expand Down

0 comments on commit 6f78534

Please sign in to comment.