Skip to content

Commit 2196f3f

Browse files
committed
Merge branch 'is1988/upgrading-director-to-fastapi' of github.com:pcrespov/osparc-simcore into is1988/upgrading-director-to-fastapi
2 parents 9369cb5 + 03a171a commit 2196f3f

File tree

28 files changed

+133
-69
lines changed

28 files changed

+133
-69
lines changed

.env-devel

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,20 @@ DASK_TLS_CA_FILE=/home/scu/.dask/dask-crt.pem
6565
DASK_TLS_CERT=/home/scu/.dask/dask-crt.pem
6666
DASK_TLS_KEY=/home/scu/.dask/dask-key.pem
6767

68+
DIRECTOR_DEFAULT_MAX_MEMORY=2_147_483_648
69+
DIRECTOR_DEFAULT_MAX_NANO_CPUS=1_000_000_000
6870
DIRECTOR_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS='{}'
6971
DIRECTOR_HOST=director
72+
DIRECTOR_LOGLEVEL=INFO
73+
DIRECTOR_MONITORING_ENABLED=True
7074
DIRECTOR_PORT=8000
75+
DIRECTOR_PUBLISHED_HOST_NAME=
7176
DIRECTOR_REGISTRY_CACHING_TTL=900
7277
DIRECTOR_REGISTRY_CACHING=True
78+
DIRECTOR_SELF_SIGNED_SSL_FILENAME=
79+
DIRECTOR_SELF_SIGNED_SSL_SECRET_ID=
80+
DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME=
81+
DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=
7382

7483
EFS_USER_ID=8006
7584
EFS_USER_NAME=efs
@@ -88,7 +97,7 @@ COMPUTATIONAL_BACKEND_DEFAULT_FILE_LINK_TYPE=PRESIGNED
8897
COMPUTATIONAL_BACKEND_ON_DEMAND_CLUSTERS_FILE_LINK_TYPE=PRESIGNED
8998
DIRECTOR_V2_DEV_FEATURES_ENABLED=0
9099
DIRECTOR_V2_DYNAMIC_SCHEDULER_CLOSE_SERVICES_VIA_FRONTEND_WHEN_CREDITS_LIMIT_REACHED=1
91-
DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL=0
100+
DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL=PT0S
92101
DIRECTOR_V2_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS='{}'
93102
DIRECTOR_V2_HOST=director-v2
94103
DIRECTOR_V2_LOGLEVEL=INFO
@@ -108,7 +117,7 @@ DYNAMIC_SIDECAR_API_SAVE_RESTORE_STATE_TIMEOUT=3600
108117
# DIRECTOR_V2 ----
109118
DYNAMIC_SCHEDULER_LOGLEVEL=DEBUG
110119
DYNAMIC_SCHEDULER_PROFILING=1
111-
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=3600
120+
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=PT1H
112121

113122
FUNCTION_SERVICES_AUTHORS='{"UN": {"name": "Unknown", "email": "[email protected]", "affiliation": "unknown"}}'
114123

@@ -171,6 +180,7 @@ REDIS_SECURE=false
171180
REDIS_USER=null
172181

173182
REGISTRY_AUTH=True
183+
REGISTRY_PATH=""
174184
REGISTRY_PW=adminadminadmin
175185
REGISTRY_SSL=True
176186
REGISTRY_URL=registry.osparc-master.speag.com

scripts/maintenance/computational-clusters/autoscaled_monitor/cli.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DEFAULT_COMPUTATIONAL_EC2_FORMAT_WORKERS,
1414
DEFAULT_DYNAMIC_EC2_FORMAT,
1515
DEPLOY_SSH_KEY_PARSER,
16+
UNIFIED_SSH_KEY_PARSE,
1617
wallet_id_spec,
1718
)
1819
from .ec2 import autoscaling_ec2_client, cluster_keeper_ec2_client
@@ -78,16 +79,12 @@ def main(
7879

7980
# locate ssh key path
8081
for file_path in deploy_config.glob("**/*.pem"):
81-
if any(_ in file_path.name for _ in ["license", "pkcs8"]):
82-
continue
83-
# very bad HACK where the license file contain openssh in the name
84-
if (
85-
any(_ in f"{file_path}" for _ in ("sim4life.io", "osparc-master"))
86-
and "openssh" not in f"{file_path}"
87-
):
82+
if any(_ in file_path.name for _ in ["license", "pkcs8", "dask"]):
8883
continue
8984

90-
if DEPLOY_SSH_KEY_PARSER.parse(f"{file_path.name}") is not None:
85+
if DEPLOY_SSH_KEY_PARSER.parse(
86+
f"{file_path.name}"
87+
) is not None or UNIFIED_SSH_KEY_PARSE.parse(f"{file_path.name}"):
9188
rich.print(
9289
f"will be using following ssh_key_path: {file_path}. "
9390
"TIP: if wrong adapt the code or manually remove some of them."

scripts/maintenance/computational-clusters/autoscaled_monitor/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def wallet_id_spec(text) -> None | int:
2222
DEPLOY_SSH_KEY_PARSER: Final[parse.Parser] = parse.compile(
2323
r"{prefix}-{random_name}.pem"
2424
)
25+
UNIFIED_SSH_KEY_PARSE: Final[parse.Parser] = parse.compile("sshkey.pem")
2526

2627
MINUTE: Final[int] = 60
2728
HOUR: Final[int] = 60 * MINUTE

services/agent/src/simcore_service_agent/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
5353
AGENT_VOLUMES_CLEANUP_INTERVAL: timedelta = Field(
5454
timedelta(minutes=1), description="interval for running volumes removal"
5555
)
56-
AGENT_VOLUMES_CLENUP_BOOK_KEEPING_INTERVAL: timedelta = Field(
56+
AGENT_VOLUMES_CLEANUP_BOOK_KEEPING_INTERVAL: timedelta = Field(
5757
timedelta(minutes=1),
5858
description=(
5959
"interval at which to scan for unsued volumes and keep track since "
6060
"they were detected as being unused"
6161
),
6262
)
63-
AGENT_VOLUMES_CLENUP_REMOVE_VOLUMES_INACTIVE_FOR: timedelta = Field(
63+
AGENT_VOLUMES_CLEANUP_REMOVE_VOLUMES_INACTIVE_FOR: timedelta = Field(
6464
timedelta(minutes=65),
6565
description=(
6666
"if a volume is unused for more than this interval it can be removed. "

services/agent/src/simcore_service_agent/services/volumes_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ async def _on_startup() -> None:
174174

175175
volumes_manager = VolumesManager(
176176
app=app,
177-
book_keeping_interval=settings.AGENT_VOLUMES_CLENUP_BOOK_KEEPING_INTERVAL,
177+
book_keeping_interval=settings.AGENT_VOLUMES_CLEANUP_BOOK_KEEPING_INTERVAL,
178178
volume_cleanup_interval=settings.AGENT_VOLUMES_CLEANUP_INTERVAL,
179-
remove_volumes_inactive_for=settings.AGENT_VOLUMES_CLENUP_REMOVE_VOLUMES_INACTIVE_FOR.total_seconds(),
179+
remove_volumes_inactive_for=settings.AGENT_VOLUMES_CLEANUP_REMOVE_VOLUMES_INACTIVE_FOR.total_seconds(),
180180
)
181181
volumes_manager.set_to_app_state(app)
182182
await volumes_manager.setup()

services/director/src/simcore_service_director/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ class ApplicationSettings(BaseCustomSettings, MixinLoggingSettings):
7373
)
7474

7575
# migrated settings
76-
DIRECTOR_DEFAULT_MAX_NANO_CPUS: int = Field(
76+
DIRECTOR_DEFAULT_MAX_NANO_CPUS: PositiveInt = Field(
7777
default=1 * pow(10, 9),
7878
env=["DIRECTOR_DEFAULT_MAX_NANO_CPUS", "DEFAULT_MAX_NANO_CPUS"],
7979
)
80-
DIRECTOR_DEFAULT_MAX_MEMORY: int = Field(
80+
DIRECTOR_DEFAULT_MAX_MEMORY: PositiveInt = Field(
8181
default=parse_obj_as(ByteSize, "2GiB"),
8282
env=["DIRECTOR_DEFAULT_MAX_MEMORY", "DEFAULT_MAX_MEMORY"],
8383
)

services/director/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ def app_settings(app_environment: EnvVarsDict) -> ApplicationSettings:
135135

136136
@pytest.fixture
137137
async def app(
138-
app_setting: ApplicationSettings, is_pdb_enabled: bool
138+
app_settings: ApplicationSettings, is_pdb_enabled: bool
139139
) -> AsyncIterator[FastAPI]:
140-
the_test_app = create_app(settings=app_setting)
140+
the_test_app = create_app(settings=app_settings)
141141
async with LifespanManager(
142142
the_test_app,
143143
startup_timeout=None if is_pdb_enabled else MAX_TIME_FOR_APP_TO_STARTUP,

services/director/tests/test_core_settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ def test_valid_web_application_settings(app_environment: EnvVarsDict):
2121

2222
assert settings == ApplicationSettings.create_from_envs()
2323

24-
assert app_environment["DIRECTOR_DEBUG"] == settings.DIRECTOR_DEBUG
24+
assert (
25+
app_environment["DIRECTOR_DEFAULT_MAX_MEMORY"]
26+
== settings.DIRECTOR_DEFAULT_MAX_MEMORY
27+
)

services/docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ services:
245245
init: true
246246
hostname: "{{.Node.Hostname}}-{{.Task.Slot}}"
247247
environment:
248-
DEFAULT_MAX_MEMORY: ${DIRECTOR_DEFAULT_MAX_MEMORY:-0}
249-
DEFAULT_MAX_NANO_CPUS: ${DIRECTOR_DEFAULT_MAX_NANO_CPUS:-0}
248+
DIRECTOR_DEFAULT_MAX_MEMORY: ${DIRECTOR_DEFAULT_MAX_MEMORY}
249+
DIRECTOR_DEFAULT_MAX_NANO_CPUS: ${DIRECTOR_DEFAULT_MAX_NANO_CPUS}
250250
DIRECTOR_REGISTRY_CACHING_TTL: ${DIRECTOR_REGISTRY_CACHING_TTL}
251251
DIRECTOR_REGISTRY_CACHING: ${DIRECTOR_REGISTRY_CACHING}
252252
DIRECTOR_SELF_SIGNED_SSL_FILENAME: ${DIRECTOR_SELF_SIGNED_SSL_FILENAME}
@@ -256,9 +256,9 @@ services:
256256
DIRECTOR_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS: ${DIRECTOR_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS}
257257
DIRECTOR_LOG_FORMAT_LOCAL_DEV_ENABLED: ${LOG_FORMAT_LOCAL_DEV_ENABLED}
258258
EXTRA_HOSTS_SUFFIX: undefined
259-
LOGLEVEL: ${LOG_LEVEL:-WARNING}
260-
MONITORING_ENABLED: ${MONITORING_ENABLED:-True}
261-
PUBLISHED_HOST_NAME: ${MACHINE_FQDN}
259+
DIRECTOR_LOGLEVEL: ${DIRECTOR_LOGLEVEL}
260+
DIRECTOR_MONITORING_ENABLED: ${DIRECTOR_MONITORING_ENABLED}
261+
DIRECTOR_PUBLISHED_HOST_NAME: ${DIRECTOR_PUBLISHED_HOST_NAME}
262262
POSTGRES_DB: ${POSTGRES_DB}
263263
POSTGRES_ENDPOINT: ${POSTGRES_ENDPOINT}
264264
POSTGRES_HOST: ${POSTGRES_HOST}

services/static-webserver/client/source/class/osparc/file/FileDrop.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ qx.Class.define("osparc.file.FileDrop", {
102102
}
103103
}
104104
return files;
105-
}
105+
},
106+
107+
ONE_FILE_ONLY: qx.locale.Manager.tr("Only one file at a time is accepted.") + "<br>" + qx.locale.Manager.tr("Please zip all files together."),
106108
},
107109

108110
events: {
@@ -299,7 +301,7 @@ qx.Class.define("osparc.file.FileDrop", {
299301
pos: this.__pointerFileEventToScreenPos(e)
300302
});
301303
} else {
302-
osparc.FlashMessenger.getInstance().logAs(this.tr("Only one file at a time is accepted."), "ERROR");
304+
osparc.FlashMessenger.getInstance().logAs(osparc.file.FileDrop.ONE_FILE_ONLY, "ERROR");
303305
}
304306
} else {
305307
osparc.FlashMessenger.getInstance().logAs(this.tr("Folders are not accepted. You might want to upload a zip file."), "ERROR");

0 commit comments

Comments
 (0)