Skip to content

Fixes on publish studies handling #1632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions services/director/src/simcore_service_director/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,31 +439,34 @@ async def _get_service_state(
tasks = await client.tasks.list(filters={"service": service_name})
# only keep the ones with the right service ID (we're being a bit picky maybe)
tasks = [x for x in tasks if x["ServiceID"] == service["ID"]]

# we are only interested in the last task which has index 0
if tasks:
last_task = tasks[0]
task_state = last_task["Status"]["State"]
log.debug("%s %s", service["ID"], task_state)
simcore_state = ServiceState.STARTING
simcore_message = (

last_task_state = ServiceState.STARTING # default
last_task_error_msg = (
last_task["Status"]["Err"] if "Err" in last_task["Status"] else ""
)
if task_state in ("failed", "rejected"):
log.error(
"service %s failed with %s", service_name, last_task["Status"]
)
simcore_state = ServiceState.FAILED
last_task_state = ServiceState.FAILED
elif task_state in ("pending"):
simcore_state = ServiceState.PENDING
last_task_state = ServiceState.PENDING
elif task_state in ("assigned", "accepted", "preparing"):
simcore_state = ServiceState.PULLING
last_task_state = ServiceState.PULLING
elif task_state in ("ready", "starting"):
simcore_state = ServiceState.STARTING
last_task_state = ServiceState.STARTING
elif task_state in ("running"):
simcore_state = ServiceState.RUNNING
last_task_state = ServiceState.RUNNING
elif task_state in ("complete", "shutdown"):
simcore_state = ServiceState.COMPLETE
return (simcore_state, simcore_message)
last_task_state = ServiceState.COMPLETE
return (last_task_state, last_task_error_msg)

# allows dealing with other events instead of wasting time here
await asyncio.sleep(1) # 1s
log.debug("Waited for service %s to start", service_name)
Expand Down Expand Up @@ -600,6 +603,7 @@ async def _start_docker_service(
service = await client.services.inspect(service["ID"])
service_name = service["Spec"]["Name"]
service_state, service_msg = await _get_service_state(client, service)

# wait for service to start
# await _wait_until_service_running_or_failed(client, service, node_uuid)
log.debug("Service %s successfully started", service_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ postgres:
password: ${POSTGRES_PASSWORD}
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
minsize: 4
maxsize: 4
minsize: 10
maxsize: 15
s3:
endpoint: ${S3_ENDPOINT}
access_key: ${S3_ACCESS_KEY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
},

__getStudyAndStart: function(loadStudyId) {
osparc.store.Store.getStudyWState(loadStudyId, true)
osparc.store.Store.getInstance().getStudyWState(loadStudyId, true)
.then(studyData => {
this.__startStudy(studyData);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ async def listen(app: web.Application):
task_output = node_data["outputs"]
node_id = node_data["node_id"]
project_id = node_data["project_id"]

# FIXME: we do not know who triggered these changes. we assume the user had the rights to do so
# therefore we'll use the prj_owner user id. This should be fixed when the new sidecar comes in
# and comp_tasks/comp_pipeline get deprecated.
Expand All @@ -89,7 +90,7 @@ async def listen(app: web.Application):
result = await conn.execute(
select([projects]).where(projects.c.uuid == project_id)
)
the_project: RowProxy = result.fetchone()
the_project: RowProxy = await result.fetchone()
if not the_project:
log.warning(
"Project %s was not found and cannot be updated", project_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ db:
password: ${POSTGRES_PASSWORD}
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
minsize: 4
minsize: 10
maxsize: 15
resource_manager:
enabled: True
Expand Down