File tree Expand file tree Collapse file tree 8 files changed +22
-19
lines changed
pytest-simcore/src/pytest_simcore/helpers
service-library/src/servicelib/rabbitmq/rpc_interfaces/webserver
api-server/src/simcore_service_api_server/services_rpc
src/simcore_service_webserver/projects Expand file tree Collapse file tree 8 files changed +22
-19
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,16 @@ async def list_projects_marked_as_jobs(
5757 offset : PageOffsetInt = 0 ,
5858 limit : PageLimitInt = DEFAULT_NUMBER_OF_ITEMS_PER_PAGE ,
5959 # filters
60- job_parent_resource_name_filter : str | None = None ,
60+ job_parent_resource_name_prefix : str | None = None ,
6161 ) -> PageRpcProjectJobRpcGet :
6262 assert rpc_client
6363 assert product_name
6464 assert user_id
6565
66- if job_parent_resource_name_filter :
67- assert not job_parent_resource_name_filter .startswith ("/" )
66+ if job_parent_resource_name_prefix :
67+ assert not job_parent_resource_name_prefix .startswith ("/" )
68+ assert not job_parent_resource_name_prefix .endswith ("%" )
69+ assert not job_parent_resource_name_prefix .startswith ("%" )
6870
6971 items = ProjectJobRpcGet .model_json_schema ()["examples" ]
7072
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ async def list_projects_marked_as_jobs(
5252 offset : PageOffsetInt = 0 ,
5353 limit : PageLimitInt = DEFAULT_NUMBER_OF_ITEMS_PER_PAGE ,
5454 # filters
55- job_parent_resource_name_filter : str | None = None ,
55+ job_parent_resource_name_prefix : str | None = None ,
5656) -> PageRpcProjectJobRpcGet :
5757 result = await rpc_client .request (
5858 WEBSERVER_RPC_NAMESPACE ,
@@ -61,7 +61,7 @@ async def list_projects_marked_as_jobs(
6161 user_id = user_id ,
6262 offset = offset ,
6363 limit = limit ,
64- job_parent_resource_name_filter = job_parent_resource_name_filter ,
64+ job_parent_resource_name_prefix = job_parent_resource_name_prefix ,
6565 )
6666 assert TypeAdapter (PageRpcProjectJobRpcGet ).validate_python (result ) # nosec
6767 return cast (PageRpcProjectJobRpcGet , result )
Original file line number Diff line number Diff line change @@ -226,15 +226,15 @@ async def list_projects_marked_as_jobs(
226226 user_id : UserID ,
227227 offset : int = 0 ,
228228 limit : int = 50 ,
229- job_parent_resource_name_filter : str | None = None ,
229+ job_parent_resource_name_prefix : str | None = None ,
230230 ):
231231 return await projects_rpc .list_projects_marked_as_jobs (
232232 rpc_client = self ._client ,
233233 product_name = product_name ,
234234 user_id = user_id ,
235235 offset = offset ,
236236 limit = limit ,
237- job_parent_resource_name_filter = job_parent_resource_name_filter ,
237+ job_parent_resource_name_prefix = job_parent_resource_name_prefix ,
238238 )
239239
240240
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async def list_projects_marked_as_jobs(
6666 offset : PageOffsetInt ,
6767 limit : PageLimitInt ,
6868 # filters
69- job_parent_resource_name_filter : str | None ,
69+ job_parent_resource_name_prefix : str | None ,
7070) -> PageRpcProjectJobRpcGet :
7171
7272 total , projects = await _jobs_service .list_my_projects_marked_as_jobs (
@@ -75,7 +75,7 @@ async def list_projects_marked_as_jobs(
7575 user_id = user_id ,
7676 offset = offset ,
7777 limit = limit ,
78- job_parent_resource_name_filter = job_parent_resource_name_filter ,
78+ job_parent_resource_name_prefix = job_parent_resource_name_prefix ,
7979 )
8080
8181 job_projects = [
Original file line number Diff line number Diff line change @@ -62,12 +62,13 @@ async def list_projects_marked_as_jobs(
6262 user_id : UserID ,
6363 offset : int = 0 ,
6464 limit : int = 10 ,
65- job_parent_resource_name_filter : str | None = None ,
65+ job_parent_resource_name_prefix : str | None = None ,
6666 ) -> tuple [int , list [ProjectJobDBGet ]]:
6767 """
6868 Lists projects marked as jobs for a specific user and product
69- """
7069
70+ Example: job_parent_resource_name = "/solvers/solver1"
71+ """
7172 # Step 1: Get group IDs associated with the user
7273 user_groups_query = (
7374 sa .select (user_to_groups .c .gid )
@@ -96,10 +97,10 @@ async def list_projects_marked_as_jobs(
9697 )
9798
9899 # Apply job_parent_resource_name_filter if provided
99- if job_parent_resource_name_filter :
100+ if job_parent_resource_name_prefix :
100101 access_query = access_query .where (
101102 projects_to_jobs .c .job_parent_resource_name .like (
102- f"% { job_parent_resource_name_filter } %"
103+ f"{ job_parent_resource_name_prefix } %"
103104 )
104105 )
105106
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ async def list_my_projects_marked_as_jobs(
5656 user_id : UserID ,
5757 offset : int = 0 ,
5858 limit : int = 10 ,
59- job_parent_resource_name_filter : str | None = None ,
59+ job_parent_resource_name_prefix : str | None = None ,
6060) -> tuple [int , list [ProjectJobDBGet ]]:
6161 """
6262 Lists paginated projects marked as jobs for the given user and product.
@@ -68,5 +68,5 @@ async def list_my_projects_marked_as_jobs(
6868 product_name = product_name ,
6969 offset = offset ,
7070 limit = limit ,
71- job_parent_resource_name_filter = job_parent_resource_name_filter ,
71+ job_parent_resource_name_prefix = job_parent_resource_name_prefix ,
7272 )
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ async def test_user_can_filter_marked_project(
158158 app = client .app ,
159159 product_name = osparc_product_name ,
160160 user_id = project_job_fixture .user_id ,
161- job_parent_resource_name_filter = project_job_fixture .job_parent_resource_name ,
161+ job_parent_resource_name_prefix = project_job_fixture .job_parent_resource_name ,
162162 )
163163 assert total_count == 1
164164 assert len (result ) == 1
@@ -174,7 +174,7 @@ async def test_user_can_filter_marked_project(
174174 app = client .app ,
175175 product_name = osparc_product_name ,
176176 user_id = project_job_fixture .user_id ,
177- job_parent_resource_name_filter = "test/%" ,
177+ job_parent_resource_name_prefix = "test/%" ,
178178 )
179179 assert total_count == 1
180180 assert len (result ) == 1
@@ -190,7 +190,7 @@ async def test_user_can_filter_marked_project(
190190 app = client .app ,
191191 product_name = osparc_product_name ,
192192 user_id = project_job_fixture .user_id ,
193- job_parent_resource_name_filter = "other/%" ,
193+ job_parent_resource_name_prefix = "other/%" ,
194194 )
195195 assert total_count == 0
196196 assert len (result ) == 0
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ async def test_rpc_client_list_my_projects_marked_as_jobs(
114114 rpc_client = rpc_client ,
115115 product_name = product_name ,
116116 user_id = user_id ,
117- job_parent_resource_name_filter = "solvers/solver123" ,
117+ job_parent_resource_name_prefix = "solvers/solver123" ,
118118 )
119119
120120 assert page .meta .total == 1
You can’t perform that action at this time.
0 commit comments