fractal-server 2.4.0a2__py3-none-any.whl → 2.4.2__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.
- fractal_server/__init__.py +1 -1
- fractal_server/__main__.py +3 -4
- fractal_server/app/routes/auth/users.py +5 -0
- fractal_server/app/runner/executors/slurm/sudo/_subprocess_run_as_user.py +1 -1
- fractal_server/app/runner/executors/slurm/sudo/executor.py +1 -1
- fractal_server/app/security/__init__.py +22 -15
- {fractal_server-2.4.0a2.dist-info → fractal_server-2.4.2.dist-info}/METADATA +1 -1
- {fractal_server-2.4.0a2.dist-info → fractal_server-2.4.2.dist-info}/RECORD +11 -11
- {fractal_server-2.4.0a2.dist-info → fractal_server-2.4.2.dist-info}/LICENSE +0 -0
- {fractal_server-2.4.0a2.dist-info → fractal_server-2.4.2.dist-info}/WHEEL +0 -0
- {fractal_server-2.4.0a2.dist-info → fractal_server-2.4.2.dist-info}/entry_points.txt +0 -0
fractal_server/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__VERSION__ = "2.4.
|
1
|
+
__VERSION__ = "2.4.2"
|
fractal_server/__main__.py
CHANGED
@@ -88,12 +88,11 @@ def set_db():
|
|
88
88
|
alembic.config.main(argv=alembic_args)
|
89
89
|
print("END: alembic.config")
|
90
90
|
# Insert default group
|
91
|
-
print(
|
91
|
+
print()
|
92
92
|
_create_first_group()
|
93
|
-
print(
|
93
|
+
print()
|
94
94
|
# NOTE: It will be fixed with #1739
|
95
95
|
settings = Inject(get_settings)
|
96
|
-
print("START: First user creation")
|
97
96
|
asyncio.run(
|
98
97
|
_create_first_user(
|
99
98
|
email=settings.FRACTAL_DEFAULT_ADMIN_EMAIL,
|
@@ -103,7 +102,7 @@ def set_db():
|
|
103
102
|
is_verified=True,
|
104
103
|
)
|
105
104
|
)
|
106
|
-
print(
|
105
|
+
print()
|
107
106
|
|
108
107
|
|
109
108
|
def update_db_data():
|
@@ -151,6 +151,11 @@ async def patch_user(
|
|
151
151
|
"reason": e.reason,
|
152
152
|
},
|
153
153
|
)
|
154
|
+
except exceptions.UserAlreadyExists:
|
155
|
+
raise HTTPException(
|
156
|
+
status.HTTP_400_BAD_REQUEST,
|
157
|
+
detail=ErrorCode.UPDATE_USER_EMAIL_ALREADY_EXISTS,
|
158
|
+
)
|
154
159
|
else:
|
155
160
|
# Nothing to do, just continue
|
156
161
|
patched_user = user_to_patch
|
@@ -49,7 +49,7 @@ def _run_command_as_user(
|
|
49
49
|
"""
|
50
50
|
logger.debug(f'[_run_command_as_user] {user=}, cmd="{cmd}"')
|
51
51
|
if user:
|
52
|
-
new_cmd = f"sudo --non-interactive -u {user} {cmd}"
|
52
|
+
new_cmd = f"sudo --set-home --non-interactive -u {user} {cmd}"
|
53
53
|
else:
|
54
54
|
new_cmd = cmd
|
55
55
|
res = subprocess.run( # nosec
|
@@ -1134,7 +1134,7 @@ class FractalSlurmExecutor(SlurmExecutor):
|
|
1134
1134
|
f.write(sbatch_script)
|
1135
1135
|
|
1136
1136
|
# Prepare submission command
|
1137
|
-
pre_command = f"sudo --non-interactive -u {self.slurm_user}"
|
1137
|
+
pre_command = f"sudo --set-home --non-interactive -u {self.slurm_user}"
|
1138
1138
|
submit_command = f"sbatch --parsable {job.slurm_script}"
|
1139
1139
|
full_command = f"{pre_command} {submit_command}"
|
1140
1140
|
|
@@ -55,9 +55,9 @@ from fractal_server.app.models import OAuthAccount
|
|
55
55
|
from fractal_server.app.models import UserGroup
|
56
56
|
from fractal_server.app.models import UserOAuth
|
57
57
|
from fractal_server.app.schemas.user import UserCreate
|
58
|
-
from fractal_server.logger import
|
58
|
+
from fractal_server.logger import set_logger
|
59
59
|
|
60
|
-
logger =
|
60
|
+
logger = set_logger(__name__)
|
61
61
|
|
62
62
|
FRACTAL_DEFAULT_GROUP_NAME = "All"
|
63
63
|
|
@@ -264,9 +264,10 @@ async def _create_first_user(
|
|
264
264
|
is_verified: `True` if the new user is verifie
|
265
265
|
username:
|
266
266
|
"""
|
267
|
+
function_logger = set_logger("fractal_server.create_first_user")
|
268
|
+
function_logger.info(f"START _create_first_user, with email '{email}'")
|
267
269
|
try:
|
268
270
|
async with get_async_session_context() as session:
|
269
|
-
|
270
271
|
if is_superuser is True:
|
271
272
|
# If a superuser already exists, exit
|
272
273
|
stm = select(UserOAuth).where( # noqa
|
@@ -275,9 +276,9 @@ async def _create_first_user(
|
|
275
276
|
res = await session.execute(stm)
|
276
277
|
existing_superuser = res.scalars().first()
|
277
278
|
if existing_superuser is not None:
|
278
|
-
|
279
|
-
f"{existing_superuser.email} superuser already
|
280
|
-
f" skip creation of {email}"
|
279
|
+
function_logger.info(
|
280
|
+
f"'{existing_superuser.email}' superuser already "
|
281
|
+
f"exists, skip creation of '{email}'"
|
281
282
|
)
|
282
283
|
return None
|
283
284
|
|
@@ -292,15 +293,19 @@ async def _create_first_user(
|
|
292
293
|
if username is not None:
|
293
294
|
kwargs["username"] = username
|
294
295
|
user = await user_manager.create(UserCreate(**kwargs))
|
295
|
-
|
296
|
+
function_logger.info(f"User '{user.email}' created")
|
296
297
|
|
297
298
|
except UserAlreadyExists:
|
298
|
-
|
299
|
+
function_logger.warning(f"User '{email}' already exists")
|
300
|
+
finally:
|
301
|
+
function_logger.info(f"END _create_first_user, with email '{email}'")
|
299
302
|
|
300
303
|
|
301
304
|
def _create_first_group():
|
302
|
-
|
303
|
-
|
305
|
+
function_logger = set_logger("fractal_server.create_first_group")
|
306
|
+
|
307
|
+
function_logger.info(
|
308
|
+
f"START _create_first_group, with name '{FRACTAL_DEFAULT_GROUP_NAME}'"
|
304
309
|
)
|
305
310
|
with next(get_sync_db()) as db:
|
306
311
|
group_all = db.execute(select(UserGroup))
|
@@ -308,11 +313,13 @@ def _create_first_group():
|
|
308
313
|
first_group = UserGroup(name=FRACTAL_DEFAULT_GROUP_NAME)
|
309
314
|
db.add(first_group)
|
310
315
|
db.commit()
|
311
|
-
|
316
|
+
function_logger.info(
|
317
|
+
f"Created group '{FRACTAL_DEFAULT_GROUP_NAME}'"
|
318
|
+
)
|
312
319
|
else:
|
313
|
-
|
314
|
-
f"Group {FRACTAL_DEFAULT_GROUP_NAME} already exists, skip."
|
320
|
+
function_logger.info(
|
321
|
+
f"Group '{FRACTAL_DEFAULT_GROUP_NAME}' already exists, skip."
|
315
322
|
)
|
316
|
-
|
317
|
-
f"END _create_first_group, with name {FRACTAL_DEFAULT_GROUP_NAME}"
|
323
|
+
function_logger.info(
|
324
|
+
f"END _create_first_group, with name '{FRACTAL_DEFAULT_GROUP_NAME}'"
|
318
325
|
)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
fractal_server/__init__.py,sha256=
|
2
|
-
fractal_server/__main__.py,sha256=
|
1
|
+
fractal_server/__init__.py,sha256=ahWw3pwB7t1_-BJaAAlCiD70Oi6bdhi1gUXGpXaDLzM,22
|
2
|
+
fractal_server/__main__.py,sha256=upYBkGYrkBnkS1rp4D_nb_1LS37QT4j-wxGX1ZMvR4A,5704
|
3
3
|
fractal_server/alembic.ini,sha256=MWwi7GzjzawI9cCAK1LW7NxIBQDUqD12-ptJoq5JpP0,3153
|
4
4
|
fractal_server/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
fractal_server/app/db/__init__.py,sha256=KpS_mfmRfew0kieFDlwkSrDFvpzxftcvPALBBZ0LxsY,4048
|
@@ -59,7 +59,7 @@ fractal_server/app/routes/auth/login.py,sha256=tSu6OBLOieoBtMZB4JkBAdEgH2Y8KqPGS
|
|
59
59
|
fractal_server/app/routes/auth/oauth.py,sha256=AnFHbjqL2AgBX3eksI931xD6RTtmbciHBEuGf9YJLjU,1895
|
60
60
|
fractal_server/app/routes/auth/register.py,sha256=DlHq79iOvGd_gt2v9uwtsqIKeO6i_GKaW59VIkllPqY,587
|
61
61
|
fractal_server/app/routes/auth/router.py,sha256=zWoZWiO69U48QFQf5tLRYQDWu8PUCj7GacnaFeW1n_I,618
|
62
|
-
fractal_server/app/routes/auth/users.py,sha256=
|
62
|
+
fractal_server/app/routes/auth/users.py,sha256=5S_TD3elAeX0TBcvsME0i2_bSXEIGSuTrjRSOPPs3o0,6876
|
63
63
|
fractal_server/app/routes/aux/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
64
|
fractal_server/app/routes/aux/_job.py,sha256=q-RCiW17yXnZKAC_0La52RLvhqhxuvbgQJ2MlGXOj8A,702
|
65
65
|
fractal_server/app/routes/aux/_runner.py,sha256=FdCVla5DxGAZ__aB7Z8dEJzD_RIeh5tftjrPyqkr8N8,895
|
@@ -81,8 +81,8 @@ fractal_server/app/runner/executors/slurm/ssh/executor.py,sha256=oCc5cLZoNmJ3ENV
|
|
81
81
|
fractal_server/app/runner/executors/slurm/sudo/__init__.py,sha256=Cjn1rYvljddi96tAwS-qqGkNfOcfPzjChdaEZEObCcM,65
|
82
82
|
fractal_server/app/runner/executors/slurm/sudo/_check_jobs_status.py,sha256=wAgwpVcr6JIslKHOuS0FhRa_6T1KCManyRJqA-fifzw,1909
|
83
83
|
fractal_server/app/runner/executors/slurm/sudo/_executor_wait_thread.py,sha256=z5LlhaiqAb8pHsF1WwdzXN39C5anQmwjo1rSQgtRAYE,4422
|
84
|
-
fractal_server/app/runner/executors/slurm/sudo/_subprocess_run_as_user.py,sha256=
|
85
|
-
fractal_server/app/runner/executors/slurm/sudo/executor.py,sha256=
|
84
|
+
fractal_server/app/runner/executors/slurm/sudo/_subprocess_run_as_user.py,sha256=0wRA-hg0JxVrFw4rBXAu6P2L2dbwzx2N_kUmpil1ErU,5143
|
85
|
+
fractal_server/app/runner/executors/slurm/sudo/executor.py,sha256=6D83o4BE5D-1LZ3BhfEmhWJ1DZrk3Vzg-b3tB5TWMAU,48471
|
86
86
|
fractal_server/app/runner/extract_archive.py,sha256=tLpjDrX47OjTNhhoWvm6iNukg8KoieWyTb7ZfvE9eWU,2483
|
87
87
|
fractal_server/app/runner/filenames.py,sha256=9lwu3yB4C67yiijYw8XIKaLFn3mJUt6_TCyVFM_aZUQ,206
|
88
88
|
fractal_server/app/runner/run_subprocess.py,sha256=KTkJnWLrLQdR2WRJ3jGu0RBu4330L3mtCAE_B0wDx3M,818
|
@@ -149,7 +149,7 @@ fractal_server/app/schemas/v2/task.py,sha256=7IfxiZkaVqlARy7WYE_H8m7j_IEcuQaZORU
|
|
149
149
|
fractal_server/app/schemas/v2/task_collection.py,sha256=8PG1bOqkfQqORMN0brWf6mHDmijt0bBW-mZsF7cSxUs,6129
|
150
150
|
fractal_server/app/schemas/v2/workflow.py,sha256=Zzx3e-qgkH8le0FUmAx9UrV5PWd7bj14PPXUh_zgZXM,1827
|
151
151
|
fractal_server/app/schemas/v2/workflowtask.py,sha256=atVuVN4aXsVEOmSd-vyg-8_8OnPmqx-gT75rXcn_AlQ,6552
|
152
|
-
fractal_server/app/security/__init__.py,sha256=
|
152
|
+
fractal_server/app/security/__init__.py,sha256=vuAE0sg2er0I2PAf7xCUHcxbMgxV1d8y6oJjO98n86o,11858
|
153
153
|
fractal_server/config.py,sha256=R0VezSe2PEDjQjHEX2V29A1jMdoomdyECBjWNY15v_0,25049
|
154
154
|
fractal_server/data_migrations/2_4_0.py,sha256=T1HRRWp9ZuXeVfBY6NRGxQ8aNIHVSftOMnB-CMrfvi8,2117
|
155
155
|
fractal_server/data_migrations/README.md,sha256=_3AEFvDg9YkybDqCLlFPdDmGJvr6Tw7HRI14aZ3LOIw,398
|
@@ -207,8 +207,8 @@ fractal_server/tasks/v2/utils.py,sha256=JOyCacb6MNvrwfLNTyLwcz8y79J29YuJeJ2MK5kq
|
|
207
207
|
fractal_server/urls.py,sha256=5o_qq7PzKKbwq12NHSQZDmDitn5RAOeQ4xufu-2v9Zk,448
|
208
208
|
fractal_server/utils.py,sha256=b7WwFdcFZ8unyT65mloFToYuEDXpQoHRcmRNqrhd_dQ,2115
|
209
209
|
fractal_server/zip_tools.py,sha256=xYpzBshysD2nmxkD5WLYqMzPYUcCRM3kYy-7n9bJL-U,4426
|
210
|
-
fractal_server-2.4.
|
211
|
-
fractal_server-2.4.
|
212
|
-
fractal_server-2.4.
|
213
|
-
fractal_server-2.4.
|
214
|
-
fractal_server-2.4.
|
210
|
+
fractal_server-2.4.2.dist-info/LICENSE,sha256=QKAharUuhxL58kSoLizKJeZE3mTCBnX6ucmz8W0lxlk,1576
|
211
|
+
fractal_server-2.4.2.dist-info/METADATA,sha256=rhvEtARu8BKU2hg2lsbhXA7NLqDXTtvWEenYBpXExmg,4628
|
212
|
+
fractal_server-2.4.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
213
|
+
fractal_server-2.4.2.dist-info/entry_points.txt,sha256=8tV2kynvFkjnhbtDnxAqImL6HMVKsopgGfew0DOp5UY,58
|
214
|
+
fractal_server-2.4.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|