fractal-server 2.18.3a0__py3-none-any.whl → 2.18.3a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- __VERSION__ = "2.18.3a0"
1
+ __VERSION__ = "2.18.3a2"
@@ -17,6 +17,7 @@ from fractal_server.app.models import UserOAuth
17
17
  from fractal_server.app.models.v2 import HistoryRun
18
18
  from fractal_server.app.models.v2 import HistoryUnit
19
19
  from fractal_server.app.models.v2 import JobV2
20
+ from fractal_server.app.models.v2.project import ProjectV2
20
21
  from fractal_server.app.routes.auth import current_superuser_act
21
22
  from fractal_server.app.routes.aux._job import _write_shutdown_file
22
23
  from fractal_server.app.routes.aux._runner import _check_shutdown_is_supported
@@ -37,6 +38,7 @@ router = APIRouter()
37
38
  @router.get("/", response_model=PaginationResponse[JobRead])
38
39
  async def view_job(
39
40
  id: int | None = None,
41
+ resource_id: int | None = None,
40
42
  user_id: int | None = None,
41
43
  project_id: int | None = None,
42
44
  dataset_id: int | None = None,
@@ -84,6 +86,13 @@ async def view_job(
84
86
  if id is not None:
85
87
  stm = stm.where(JobV2.id == id)
86
88
  stm_count = stm_count.where(JobV2.id == id)
89
+ if resource_id is not None:
90
+ stm = stm.join(ProjectV2, ProjectV2.id == JobV2.project_id).where(
91
+ ProjectV2.resource_id == resource_id
92
+ )
93
+ stm_count = stm_count.join(
94
+ ProjectV2, ProjectV2.id == JobV2.project_id
95
+ ).where(ProjectV2.resource_id == resource_id)
87
96
  if user_id is not None:
88
97
  stm = (
89
98
  stm.join(
@@ -3,6 +3,8 @@ from httpx_oauth.clients.github import GitHubOAuth2
3
3
  from httpx_oauth.clients.google import GoogleOAuth2
4
4
  from httpx_oauth.clients.openid import OpenID
5
5
  from httpx_oauth.clients.openid import OpenIDConfigurationError
6
+ from httpx_oauth.exceptions import GetIdEmailError
7
+ from httpx_oauth.exceptions import GetProfileError
6
8
 
7
9
  from fractal_server.config import OAuthSettings
8
10
  from fractal_server.config import get_oauth_settings
@@ -13,6 +15,29 @@ from . import cookie_backend
13
15
  from . import fastapi_users
14
16
 
15
17
 
18
+ class FractalOpenID(OpenID):
19
+ """
20
+ Subclass of `httpx_oauth.clients.openid.OpenID` with customizable name for
21
+ the `"email"` claim.
22
+ """
23
+
24
+ def __init__(self, *, email_claim: str, **kwargs):
25
+ super().__init__(**kwargs)
26
+ self.email_claim = email_claim
27
+
28
+ # TODO-requires-py312: add `@override` decorator
29
+ async def get_id_email(self, token: str) -> tuple[str, str | None]:
30
+ """
31
+ Identical to the parent-class method (httpx-oauth version 0.16.1),
32
+ apart from making `"email"` configurable.
33
+ """
34
+ try:
35
+ profile = await self.get_profile(token)
36
+ except GetProfileError as e:
37
+ raise GetIdEmailError(response=e.response) from e
38
+ return str(profile["sub"]), profile.get(self.email_claim)
39
+
40
+
16
41
  def _create_client_github(cfg: OAuthSettings) -> GitHubOAuth2:
17
42
  return GitHubOAuth2(
18
43
  client_id=cfg.OAUTH_CLIENT_ID.get_secret_value(),
@@ -29,10 +54,11 @@ def _create_client_google(cfg: OAuthSettings) -> GoogleOAuth2:
29
54
 
30
55
  def _create_client_oidc(cfg: OAuthSettings) -> OpenID:
31
56
  try:
32
- open_id = OpenID(
57
+ open_id = FractalOpenID(
33
58
  client_id=cfg.OAUTH_CLIENT_ID.get_secret_value(),
34
59
  client_secret=cfg.OAUTH_CLIENT_SECRET.get_secret_value(),
35
60
  openid_configuration_endpoint=cfg.OAUTH_OIDC_CONFIG_ENDPOINT.get_secret_value(), # noqa
61
+ email_claim=cfg.OAUTH_EMAIL_CLAIM,
36
62
  )
37
63
  except OpenIDConfigurationError as e:
38
64
  OAUTH_OIDC_CONFIG_ENDPOINT = (
@@ -28,6 +28,11 @@ class OAuthSettings(BaseSettings):
28
28
  String to be used as `redirect_url` argument in
29
29
  `fastapi_users.get_oauth_router`, and then in
30
30
  `httpx_oauth.integrations.fastapi.OAuth2AuthorizeCallback`.
31
+ OAUTH_EMAIL_CLAIM:
32
+ Name of the OIDC claim with the user's email address. This is
33
+ `"email"` by default, but can be customized (e.g. to `"mail"`) to
34
+ fit with the response from the userinfo endpoint - see
35
+ https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse
31
36
  """
32
37
 
33
38
  model_config = SettingsConfigDict(**SETTINGS_CONFIG_DICT)
@@ -43,6 +48,7 @@ class OAuthSettings(BaseSettings):
43
48
  OAUTH_CLIENT_SECRET: SecretStr | None = None
44
49
  OAUTH_OIDC_CONFIG_ENDPOINT: SecretStr | None = None
45
50
  OAUTH_REDIRECT_URL: str | None = None
51
+ OAUTH_EMAIL_CLAIM: str = "email"
46
52
 
47
53
  @model_validator(mode="after")
48
54
  def check_configuration(self: Self) -> Self:
@@ -6,6 +6,18 @@ import subprocess # nosec
6
6
  from fractal_server.runner.exceptions import TaskExecutionError
7
7
  from fractal_server.string_tools import validate_cmd
8
8
 
9
+ MAX_LEN_STDERR = 100_000
10
+
11
+
12
+ def placeholder_if_too_long(stderr: str) -> str:
13
+ """Returns a placeholder if the string is too long"""
14
+ if len(stderr) > MAX_LEN_STDERR:
15
+ return (
16
+ f"Cannot display stderr of length {len(stderr)}. You can find the "
17
+ "detailed logs by downloading the job-log folder."
18
+ )
19
+ return stderr
20
+
9
21
 
10
22
  def call_command_wrapper(*, cmd: str, log_path: str) -> None:
11
23
  """
@@ -46,6 +58,7 @@ def call_command_wrapper(*, cmd: str, log_path: str) -> None:
46
58
  if os.path.isfile(log_path):
47
59
  with open(log_path) as fp_stderr:
48
60
  stderr = fp_stderr.read()
61
+ stderr = placeholder_if_too_long(stderr)
49
62
  raise TaskExecutionError(
50
63
  f"Task failed with returncode={result.returncode}.\n"
51
64
  f"STDERR: {stderr}"
@@ -1,35 +1,29 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fractal-server
3
- Version: 2.18.3a0
3
+ Version: 2.18.3a2
4
4
  Summary: Backend component of the Fractal analytics platform
5
+ Author: Tommaso Comparin, Marco Franzon, Yuri Chiucconi, Jacopo Nespolo
6
+ Author-email: Tommaso Comparin <tommaso.comparin@exact-lab.it>, Marco Franzon <marco.franzon@exact-lab.it>, Yuri Chiucconi <yuri.chiucconi@exact-lab.it>, Jacopo Nespolo <jacopo.nespolo@exact-lab.it>
5
7
  License-Expression: BSD-3-Clause
6
- License-File: LICENSE
7
- Author: Tommaso Comparin
8
- Author-email: tommaso.comparin@exact-lab.it
9
- Requires-Python: >=3.11,<3.15
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.11
12
- Classifier: Programming Language :: Python :: 3.12
13
- Classifier: Programming Language :: Python :: 3.13
14
- Classifier: Programming Language :: Python :: 3.14
15
- Requires-Dist: alembic (>=1.13.1,<2.0.0)
16
- Requires-Dist: fabric (>=3.2.2,<3.3.0)
17
- Requires-Dist: fastapi (>=0.120.0,<0.121.0)
18
- Requires-Dist: fastapi-users[oauth] (>=15,<16)
19
- Requires-Dist: gunicorn (>=23.0,<24.0)
20
- Requires-Dist: packaging (>=25.0.0,<26.0.0)
21
- Requires-Dist: psycopg[binary] (>=3.1.0,<4.0.0)
22
- Requires-Dist: pydantic (>=2.12.0,<2.13.0)
23
- Requires-Dist: pydantic-settings (==2.11.0)
24
- Requires-Dist: sqlalchemy[asyncio] (>=2.0.23,<2.1)
25
- Requires-Dist: sqlmodel (==0.0.27)
26
- Requires-Dist: tomli_w (>=1.2.0,<1.3.0)
27
- Requires-Dist: uvicorn (>=0.38.0,<0.39.0)
28
- Requires-Dist: uvicorn-worker (==0.4.0)
29
- Project-URL: Documentation, https://fractal-analytics-platform.github.io/fractal-server
30
- Project-URL: Homepage, https://github.com/fractal-analytics-platform/fractal-server
31
- Project-URL: Repository, https://github.com/fractal-analytics-platform/fractal-server
8
+ Requires-Dist: fastapi>=0.120.0,<0.121.0
9
+ Requires-Dist: sqlmodel==0.0.27
10
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.23,<2.1
11
+ Requires-Dist: fastapi-users[oauth]>=15,<16
12
+ Requires-Dist: alembic>=1.13.1,<2.0.0
13
+ Requires-Dist: uvicorn>=0.38.0,<0.39.0
14
+ Requires-Dist: uvicorn-worker==0.4.0
15
+ Requires-Dist: pydantic>=2.12.0,<2.13.0
16
+ Requires-Dist: pydantic-settings==2.11.0
17
+ Requires-Dist: packaging>=25.0.0,<26.0.0
18
+ Requires-Dist: fabric>=3.2.2,<3.3.0
19
+ Requires-Dist: gunicorn>=23.0,<24.0
20
+ Requires-Dist: psycopg[binary]>=3.1.0,<4.0.0
21
+ Requires-Dist: tomli-w>=1.2.0,<1.3.0
22
+ Requires-Python: >=3.11, <3.15
32
23
  Project-URL: changelog, https://github.com/fractal-analytics-platform/fractal-server/blob/main/CHANGELOG.md
24
+ Project-URL: documentation, https://fractal-analytics-platform.github.io/fractal-server
25
+ Project-URL: homepage, https://github.com/fractal-analytics-platform/fractal-server
26
+ Project-URL: repository, https://github.com/fractal-analytics-platform/fractal-server
33
27
  Description-Content-Type: text/markdown
34
28
 
35
29
  # Fractal Server
@@ -63,4 +57,3 @@ See https://fractal-analytics-platform.github.io/fractal-server.
63
57
  Fractal was conceived in the Liberali Lab at the Friedrich Miescher Institute for Biomedical Research and in the Pelkmans Lab at the University of Zurich by [@jluethi](https://github.com/jluethi) and [@gusqgm](https://github.com/gusqgm). The Fractal project is now developed at the [BioVisionCenter](https://www.biovisioncenter.uzh.ch/en.html) at the University of Zurich and the project lead is with [@jluethi](https://github.com/jluethi). The core development is done under contract by [eXact lab S.r.l.](https://www.exact-lab.it).
64
58
 
65
59
  Unless otherwise specified, Fractal components are released under the BSD 3-Clause License, and copyright is with the BioVisionCenter at the University of Zurich.
66
-
@@ -1,4 +1,4 @@
1
- fractal_server/__init__.py,sha256=dEhdl9EtyqOPj5CiMlEv2OAVTTkU6dc3GeZ002YM4p8,25
1
+ fractal_server/__init__.py,sha256=Rzw6TOYnnUFPK6rCXCcX9YI2QCykuOzwafCf3c0dUAk,25
2
2
  fractal_server/__main__.py,sha256=QeKoAgqoiozLJDa8kSVe-Aso1WWgrk1yLUYWS8RxZVM,11405
3
3
  fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
4
4
  fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,7 +25,7 @@ fractal_server/app/routes/admin/v2/__init__.py,sha256=VF4wg09fvz6gVgIFe-r7LoCU9t
25
25
  fractal_server/app/routes/admin/v2/_aux_functions.py,sha256=fqA5sUCFuD2iVANQt2WUUfVOEVz5egQA7inzUKYGCw0,1684
26
26
  fractal_server/app/routes/admin/v2/accounting.py,sha256=xNXyQYpa0K0bOjd5WNVKfU6zBhvT2-Xgrx2F4vdS9C0,3512
27
27
  fractal_server/app/routes/admin/v2/impersonate.py,sha256=ictDjuvBr3iLv3YtwkVRMNQRq5qtPAeAXbbC7STSsEg,1125
28
- fractal_server/app/routes/admin/v2/job.py,sha256=nishNH472KMmz9Au8_w6xOOAXEN3tqVSUX1IraO1Hr0,10430
28
+ fractal_server/app/routes/admin/v2/job.py,sha256=UaUwD5vsIPslc6KrbUPs2OsGcJOsLd7UeE2a5GRZnD0,10837
29
29
  fractal_server/app/routes/admin/v2/profile.py,sha256=DwLlA9K3hkl9BqzyifIDiaWeHOM_N_17kqB5CSJOhSI,3165
30
30
  fractal_server/app/routes/admin/v2/resource.py,sha256=c2z6b_D_W6_dqVnxNF8F8OdlI5Z4asex8Zgfwzjbi2Q,6330
31
31
  fractal_server/app/routes/admin/v2/sharing.py,sha256=x7RtbDPapyENEU_s4-glPoEeEOxxj2VBgduVQ1V7wkE,3796
@@ -65,7 +65,7 @@ fractal_server/app/routes/auth/_aux_auth.py,sha256=gKdYTWUzxcU44Iep787zReWwdAs4k
65
65
  fractal_server/app/routes/auth/current_user.py,sha256=uDWttWo9isG69Jv1EGnnr2Ki5ZGd0D76jgjVDQMkn8c,3251
66
66
  fractal_server/app/routes/auth/group.py,sha256=uR98vdQHH-7BFl-Czj85ESPxT2yQymy4qtagaMrnUPU,6491
67
67
  fractal_server/app/routes/auth/login.py,sha256=buVa5Y8T0cd_SW1CqC-zMv-3SfPxGJknf7MYlUyKOl0,567
68
- fractal_server/app/routes/auth/oauth.py,sha256=NxrwOWBGPe7hLPEnD66nfWPGMWzDM80LIrwtmONVw-4,2731
68
+ fractal_server/app/routes/auth/oauth.py,sha256=ocQjyy6OfuEORDYVVzQSgcisSwL-YLZxacq7FuzwJF4,3673
69
69
  fractal_server/app/routes/auth/register.py,sha256=IiUJhgY0ZrTs0RlBRRjoTv4wF5Gb3eXTInFV-dXkpsE,615
70
70
  fractal_server/app/routes/auth/router.py,sha256=Zip_fw9qJWtoXWjluznschyrCKb2n_rf3xWarSXMkgI,692
71
71
  fractal_server/app/routes/auth/users.py,sha256=5BagdH1dz-ZoXdvTgIo9QWBNFPW3p1pIZfY9BBu4eds,7397
@@ -103,9 +103,8 @@ fractal_server/config/_data.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
103
103
  fractal_server/config/_database.py,sha256=0_FvboMkQEKKRxvr9uFdp98oiQwMTFbdCW3loTZNSY0,1846
104
104
  fractal_server/config/_email.py,sha256=vMwLHN9-beYp_-up-WkTpeyNUZk4EHwt3N2l6-PYnx4,4364
105
105
  fractal_server/config/_main.py,sha256=6splUmAPRD1J9HXkeZ-Vqif7Nw4ljJXIugpvRrcwPeI,2476
106
- fractal_server/config/_oauth.py,sha256=UTmlFppDZcOQhr3RvkiG5XMqvr54XRAQ_Y-iR0V8N-8,2024
106
+ fractal_server/config/_oauth.py,sha256=kktD0MEZ_NV4QOK6RmOXDK1x8RCrFEkqC6WLY-DzRIY,2390
107
107
  fractal_server/config/_settings_config.py,sha256=tsyXQOnn9QKCFJD6hRo_dJXlQQyl70DbqgHMJoZ1xnY,144
108
- fractal_server/data_migrations/README.md,sha256=_3AEFvDg9YkybDqCLlFPdDmGJvr6Tw7HRI14aZ3LOIw,398
109
108
  fractal_server/data_migrations/tools.py,sha256=LeMeASwYGtEqd-3wOLle6WARdTGAimoyMmRbbJl-hAM,572
110
109
  fractal_server/exceptions.py,sha256=l6aZDk_6u_9PwDaQSoIFdI40ekpzqOJaxjx5rhW-HVI,141
111
110
  fractal_server/gunicorn_fractal.py,sha256=u6U01TLGlXgq1v8QmEpLih3QnsInZD7CqphgJ_GrGzc,1230
@@ -183,7 +182,7 @@ fractal_server/runner/config/slurm_mem_to_MB.py,sha256=6KmrIC-NymQjb9-bIQjNYQx6m
183
182
  fractal_server/runner/exceptions.py,sha256=N8DLn7tuV8zMSdr8xdJN0aIdytPveSCeQ1Y5IoxXW-8,1778
184
183
  fractal_server/runner/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
185
184
  fractal_server/runner/executors/base_runner.py,sha256=h8uE5gr6zFEwpjhasJDc-eNTMIw3RwmQQLYD6U5w8E0,7116
186
- fractal_server/runner/executors/call_command_wrapper.py,sha256=n6c9haKyIudBlz9-d3GQb19rewBR54qLG8jlrma6okk,1415
185
+ fractal_server/runner/executors/call_command_wrapper.py,sha256=yLFfwkYdfGAp6TSLx0omymW3IxaDNdxV-DDk-3oqNx0,1828
187
186
  fractal_server/runner/executors/local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
188
187
  fractal_server/runner/executors/local/get_local_config.py,sha256=oI32JawlG3ixYdjxJDRfT0sreEnoHekhiAHzlejl2aM,1694
189
188
  fractal_server/runner/executors/local/runner.py,sha256=0s0u5ONasXdsvS2WD5zxksQgved_XGXtaxCEiBJoAlM,12297
@@ -268,8 +267,7 @@ fractal_server/types/validators/_workflow_task_arguments_validators.py,sha256=zt
268
267
  fractal_server/urls.py,sha256=QjIKAC1a46bCdiPMu3AlpgFbcv6a4l3ABcd5xz190Og,471
269
268
  fractal_server/utils.py,sha256=-rjg8QTXQcKweXjn0NcmETFs1_uM9PGnbl0Q7c4ERPM,2181
270
269
  fractal_server/zip_tools.py,sha256=Uhn-ax4_9g1PJ32BdyaX30hFpAeVOv2tZYTUK-zVn1E,5719
271
- fractal_server-2.18.3a0.dist-info/METADATA,sha256=gvMqw6he1Mg5FoCHcVzHL1i3ywNWUhVfVz_Lqa_XF5I,4277
272
- fractal_server-2.18.3a0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
273
- fractal_server-2.18.3a0.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
274
- fractal_server-2.18.3a0.dist-info/licenses/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
275
- fractal_server-2.18.3a0.dist-info/RECORD,,
270
+ fractal_server-2.18.3a2.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
271
+ fractal_server-2.18.3a2.dist-info/entry_points.txt,sha256=3TpdcjmETRYWJxFyAh3z-9955EWua9jdkSnBwxES1uE,60
272
+ fractal_server-2.18.3a2.dist-info/METADATA,sha256=gaWGl_yrUyqMMTGt-z2Aw53MAlLURTYVObPvmskNmY8,4163
273
+ fractal_server-2.18.3a2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.18
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ fractalctl = fractal_server.__main__:run
3
+
@@ -1,6 +0,0 @@
1
- Modules in this folder are consumed from the `update_db_data` function in
2
- `fractal_server/__main__.py`. They must expose a `fix_db` function, and they
3
- must be named according to `_slugify_version` (e.g. both for versions `1.4.3`
4
- and `1.4.3a0` the module name is `1_4_3.py`).
5
- Modules corresponding to old versions should be moved to the `old` subfolder,
6
- which is not included in the package wheel.
@@ -1,4 +0,0 @@
1
- Wheel-Version: 1.0
2
- Generator: poetry-core 2.2.1
3
- Root-Is-Purelib: true
4
- Tag: py3-none-any
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- fractalctl=fractal_server.__main__:run
3
-
@@ -1,29 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright 2022 (C) Friedrich Miescher Institute for Biomedical Research and University of Zurich
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- * Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- * Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.