Skip to content

Commit 6b16003

Browse files
authored
Merge branch 'master' into pr-osparc-add-disk-stats-at-boot
2 parents a700037 + fa9d3a0 commit 6b16003

File tree

12 files changed

+117
-34
lines changed

12 files changed

+117
-34
lines changed

packages/models-library/src/models_library/api_schemas_webserver/wallets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ class WalletGetPermissions(WalletGet):
7474
)
7575

7676

77-
class CreateWalletBodyParams(OutputSchema):
77+
class CreateWalletBodyParams(InputSchema):
7878
name: str
7979
description: str | None = None
8080
thumbnail: str | None = None
8181

8282

83-
class PutWalletBodyParams(OutputSchema):
83+
class PutWalletBodyParams(InputSchema):
8484
name: str
8585
description: str | None
86-
thumbnail: str | None
86+
thumbnail: str | None = None
8787
status: WalletStatus
8888

8989

services/director-v2/src/simcore_service_director_v2/api/rpc/_computations.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
from models_library.users import UserID
1414
from servicelib.rabbitmq import RPCRouter
1515
from servicelib.utils import limited_gather
16-
from simcore_service_director_v2.models.comp_tasks import ComputationTaskForRpcDBGet
1716

17+
from ...core.errors import ComputationalRunNotFoundError
18+
from ...models.comp_runs import CompRunsAtDB
19+
from ...models.comp_tasks import ComputationTaskForRpcDBGet
1820
from ...modules.db.repositories.comp_runs import CompRunsRepository
1921
from ...modules.db.repositories.comp_tasks import CompTasksRepository
2022
from ...utils import dask as dask_utils
@@ -95,6 +97,19 @@ async def _fetch_task_log(
9597
return None
9698

9799

100+
async def _get_latest_run_or_none(
101+
comp_runs_repo: CompRunsRepository,
102+
user_id: UserID,
103+
project_uuid: ProjectID,
104+
) -> CompRunsAtDB | None:
105+
try:
106+
return await comp_runs_repo.get(
107+
user_id=user_id, project_id=project_uuid, iteration=None
108+
)
109+
except ComputationalRunNotFoundError:
110+
return None
111+
112+
98113
@router.expose(reraise_if_error_type=())
99114
async def list_computations_latest_iteration_tasks_page(
100115
app: FastAPI,
@@ -127,13 +142,15 @@ async def list_computations_latest_iteration_tasks_page(
127142
# Fetch latest run for each project concurrently
128143
latest_runs = await limited_gather(
129144
*[
130-
comp_runs_repo.get(user_id=user_id, project_id=project_uuid, iteration=None)
145+
_get_latest_run_or_none(comp_runs_repo, user_id, project_uuid)
131146
for project_uuid in unique_project_uuids
132147
],
133148
limit=20,
134149
)
135150
# Build a dict: project_uuid -> iteration
136-
project_uuid_to_iteration = {run.project_uuid: run.iteration for run in latest_runs}
151+
project_uuid_to_iteration = {
152+
run.project_uuid: run.iteration for run in latest_runs if run is not None
153+
}
137154

138155
# Run all log fetches concurrently
139156
log_files = await limited_gather(

services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ async def list_for_user__only_latest_iterations(
221221
if order_by is None:
222222
order_by = OrderBy(field=IDStr("run_id")) # default ordering
223223

224-
base_select_query = sa.select(
225-
*self._COMPUTATION_RUNS_RPC_GET_COLUMNS
226-
).select_from(
224+
_latest_runs = (
227225
sa.select(
228226
comp_runs.c.project_uuid,
229227
sa.func.max(comp_runs.c.iteration).label(
@@ -235,26 +233,28 @@ async def list_for_user__only_latest_iterations(
235233
& (
236234
comp_runs.c.metadata["product_name"].astext == product_name
237235
) # <-- NOTE: We might create a separate column for this for fast retrieval
238-
& (
239-
comp_runs.c.result.in_(
240-
[
241-
RUNNING_STATE_TO_DB[item]
242-
for item in RunningState.list_running_states()
243-
]
244-
)
245-
)
246-
if filter_only_running
247-
else True
248236
)
249237
.group_by(comp_runs.c.project_uuid)
250-
.subquery("latest_runs")
251-
.join(
238+
)
239+
if filter_only_running:
240+
_latest_runs = _latest_runs.where(
241+
comp_runs.c.result.in_(
242+
[
243+
RUNNING_STATE_TO_DB[item]
244+
for item in RunningState.list_running_states()
245+
]
246+
)
247+
)
248+
_latest_runs_subquery = _latest_runs.subquery().alias("latest_runs")
249+
250+
base_select_query = sa.select(
251+
*self._COMPUTATION_RUNS_RPC_GET_COLUMNS
252+
).select_from(
253+
_latest_runs_subquery.join(
252254
comp_runs,
253255
sa.and_(
254-
comp_runs.c.project_uuid
255-
== literal_column("latest_runs.project_uuid"),
256-
comp_runs.c.iteration
257-
== literal_column("latest_runs.latest_iteration"),
256+
comp_runs.c.project_uuid == _latest_runs_subquery.c.project_uuid,
257+
comp_runs.c.iteration == _latest_runs_subquery.c.latest_iteration,
258258
),
259259
)
260260
)

services/static-webserver/client/source/class/osparc/data/Resources.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ qx.Class.define("osparc.data.Resources", {
352352
endpoints: {
353353
getPageLatest: {
354354
method: "GET",
355-
url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D&filter_only_running={runningOnly}"
355+
url: statics.API + "/computations/-/iterations/latest?offset={offset}&limit={limit}&order_by=%7B%22field%22:%22submitted_at%22,%22direction%22:%22desc%22%7D&filter_only_running={runningOnly}&filters={filters}"
356356
},
357357
getPageHistory: {
358358
method: "GET",

services/static-webserver/client/source/class/osparc/desktop/MainPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ qx.Class.define("osparc.desktop.MainPage", {
6969
preloadPromises.push(osparc.store.Tags.getInstance().fetchTags());
7070
preloadPromises.push(osparc.store.Products.getInstance().fetchUiConfig());
7171
preloadPromises.push(osparc.store.PollTasks.getInstance().fetchTasks());
72-
preloadPromises.push(osparc.store.Jobs.getInstance().fetchJobsActive());
72+
preloadPromises.push(osparc.store.Jobs.getInstance().fetchJobsLatest());
7373
Promise.all(preloadPromises)
7474
.then(() => {
7575
const mainStack = this.__createMainStack();

services/static-webserver/client/source/class/osparc/jobs/JobsButton.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ qx.Class.define("osparc.jobs.JobsButton", {
3434

3535
const jobsStore = osparc.store.Jobs.getInstance();
3636
jobsStore.addListener("changeJobsActive", e => this.__updateJobsButton(e.getData()), this);
37-
jobsStore.fetchJobsActive();
37+
jobsStore.fetchJobsLatest();
3838
},
3939

4040
members: {

services/static-webserver/client/source/class/osparc/jobs/RunsBrowser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ qx.Class.define("osparc.jobs.RunsBrowser", {
5757
allowStretchX: true,
5858
margin: 0
5959
});
60+
control.getChildControl("textfield").set({
61+
placeholder: qx.locale.Manager.tr("Filter by name or ID"),
62+
});
63+
control.hide(); // @matusdrobuliak66: remove this when the backend is ready
6064
this.getChildControl("header-filter").add(control, {
6165
flex: 1
6266
});

services/static-webserver/client/source/class/osparc/jobs/RunsTableModel.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
7575
nullable: true,
7676
check : "String",
7777
init: "",
78+
apply: "reloadData",
7879
},
7980
},
8081

@@ -95,7 +96,8 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
9596
if (this.getProjectUuid()) {
9697
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectUuid(), this.__includeChildren, offset, limit, orderBy, resolveWResponse);
9798
} else {
98-
promise = osparc.store.Jobs.getInstance().fetchJobsActive(this.getRunningOnly(), offset, limit, orderBy, resolveWResponse);
99+
const filters = this.getFilterString() ? { text: this.getFilterString() } : null;
100+
promise = osparc.store.Jobs.getInstance().fetchJobsLatest(this.getRunningOnly(), offset, limit, orderBy, filters, resolveWResponse);
99101
}
100102
promise
101103
.then(resp => {
@@ -118,7 +120,8 @@ qx.Class.define("osparc.jobs.RunsTableModel", {
118120
if (this.getProjectUuid()) {
119121
promise = osparc.store.Jobs.getInstance().fetchJobsHistory(this.getProjectUuid(), this.__includeChildren, offset, limit, orderBy);
120122
} else {
121-
promise = osparc.store.Jobs.getInstance().fetchJobsActive(this.getRunningOnly(), offset, limit, orderBy);
123+
const filters = this.getFilterString() ? { text: this.getFilterString() } : null;
124+
promise = osparc.store.Jobs.getInstance().fetchJobsLatest(this.getRunningOnly(), offset, limit, orderBy, filters);
122125
}
123126
return promise
124127
.then(jobs => {

services/static-webserver/client/source/class/osparc/store/Jobs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ qx.Class.define("osparc.store.Jobs", {
3737
},
3838

3939
members: {
40-
fetchJobsActive: function(
40+
fetchJobsLatest: function(
4141
runningOnly = true,
4242
offset = 0,
4343
limit = this.self().SERVER_MAX_LIMIT,
4444
orderBy = {
4545
field: "submitted_at",
4646
direction: "desc"
4747
},
48+
filters = null,
4849
resolveWResponse = false
4950
) {
5051
const params = {
@@ -53,6 +54,7 @@ qx.Class.define("osparc.store.Jobs", {
5354
offset,
5455
limit,
5556
orderBy: JSON.stringify(orderBy),
57+
filters: JSON.stringify(filters ? filters : {}),
5658
}
5759
};
5860
const options = {

services/web/server/setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ commit_args = --no-verify
1313
addopts = --strict-markers
1414
asyncio_mode = auto
1515
asyncio_default_fixture_loop_scope = function
16-
markers =
16+
markers =
1717
slow: marks tests as slow (deselect with '-m "not slow"')
1818
acceptance_test: "marks tests as 'acceptance tests' i.e. does the system do what the user expects? Typically those are workflows."
1919
testit: "marks test to run during development"
2020
heavy_load: "mark tests that require large amount of data"
2121

2222
[mypy]
23-
plugins =
23+
plugins =
2424
pydantic.mypy
2525
sqlalchemy.ext.mypy.plugin

0 commit comments

Comments
 (0)