Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix minor bugs in project plugin and director #4123

Merged
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://pre-commit.com/hooks.html for more hooks
exclude: "^.venv$|^.cache$|^.pytest_cache$"
fail_fast: true
fail_fast: false
default_language_version:
python: python3.10
repos:
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ push-version: tag-version
setuptools
@$@/bin/pip3 list --verbose

devenv: .venv ## create a python virtual environment with dev tools (e.g. linters, etc)
devenv: .venv .vscode/settings.json .vscode/launch.json ## create a development environment (configs, virtual-env, hooks, ...)
$</bin/pip3 --quiet install -r requirements/devenv.txt
# Installing pre-commit hooks in current .git repo
@$</bin/pre-commit install
Expand Down Expand Up @@ -465,10 +465,16 @@ nodenv: node_modules ## builds node_modules local environ (TODO)
@echo "WARNING ##### $@ does not exist, cloning $< as $@ ############"; cp $< $@)


.vscode/settings.json: .vscode-template/settings.json
$(info WARNING: ##### $< is newer than $@ ####)
@diff -uN $@ $<
@false
.vscode/settings.json: .vscode/settings.template.json
$(if $(wildcard $@), \
@echo "WARNING ##### $< is newer than $@ ####"; diff -uN $@ $<; false;,\
@echo "WARNING ##### $@ does not exist, cloning $< as $@ ############"; cp $< $@)


.vscode/launch.json: .vscode/launch.template.json
$(if $(wildcard $@), \
@echo "WARNING ##### $< is newer than $@ ####"; diff -uN $@ $<; false;,\
@echo "WARNING ##### $@ does not exist, cloning $< as $@ ############"; cp $< $@)



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Config(PortSchema.Config):
"examples": [
{
"mapping": "some_filename.txt",
"url": "ftp://some_file_url",
"url": "sftp://some_file_url",
"required": True,
},
{
Expand Down
16 changes: 8 additions & 8 deletions packages/models-library/src/models_library/rest_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,23 @@ class Config:
{
"_meta": {"total": 7, "count": 4, "limit": 4, "offset": 0},
"_links": {
"self": "http://osparc.io/v2/listing?offset=0&limit=4",
"first": "http://osparc.io/v2/listing?offset=0&limit=4",
"self": "https://osparc.io/v2/listing?offset=0&limit=4",
"first": "https://osparc.io/v2/listing?offset=0&limit=4",
"prev": None,
"next": "http://osparc.io/v2/listing?offset=1&limit=4",
"last": "http://osparc.io/v2/listing?offset=1&limit=4",
"next": "https://osparc.io/v2/listing?offset=1&limit=4",
"last": "https://osparc.io/v2/listing?offset=1&limit=4",
},
"data": ["data 1", "data 2", "data 3", "data 4"],
},
# second and last page
{
"_meta": {"total": 7, "count": 3, "limit": 4, "offset": 1},
"_links": {
"self": "http://osparc.io/v2/listing?offset=1&limit=4",
"first": "http://osparc.io/v2/listing?offset=0&limit=4",
"prev": "http://osparc.io/v2/listing?offset=0&limit=4",
"self": "https://osparc.io/v2/listing?offset=1&limit=4",
"first": "https://osparc.io/v2/listing?offset=0&limit=4",
"prev": "https://osparc.io/v2/listing?offset=0&limit=4",
"next": None,
"last": "http://osparc.io/v2/listing?offset=1&limit=4",
"last": "https://osparc.io/v2/listing?offset=1&limit=4",
},
"data": ["data 5", "data 6", "data 7"],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/models-library/src/models_library/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ class Config:
"version": "1.0.9",
"name": "sim4life",
"description": "s4l web",
"thumbnail": "http://thumbnailit.org/image",
"thumbnail": "https://thumbnailit.org/image",
"quality": {
"enabled": True,
"tsr_target": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/demo-meta/osparc_webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def iter_project_iteration(
# SETUP ------------------------------------------
class ClientSettings(BaseSettings):

OSPARC_API_URL: AnyUrl = Field(default="http://127.0.0.1.nip.io:9081/v0")
OSPARC_API_URL: AnyUrl = Field(default="http://127.0.0.1.nip.io:9081/v0") # NOSONAR
OSPARC_USER_EMAIL: EmailStr
OSPARC_USER_PASSWORD: SecretStr

Expand Down
2 changes: 1 addition & 1 deletion scripts/demo/create_portal_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ISSUE = r"https://github.com/ITISFoundation/osparc-simcore/issues/"

HOST_URLS_MAPS = [
("localhost", r"http://127.0.0.1:9081"),
("localhost", r"http://127.0.0.1:9081"), # NOSONAR
("master", r"https://master.osparc.io"),
("staging", r"https://staging.osparc.io"),
("production", r"https://osparc.io"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DirectorSettings(BaseCustomSettings):

@cached_property
def base_url(self) -> str:
return f"http://{self.DIRECTOR_HOST}:{self.DIRECTOR_PORT}/{self.DIRECTOR_VTAG}"
return f"http://{self.DIRECTOR_HOST}:{self.DIRECTOR_PORT}/{self.DIRECTOR_VTAG}" # NOSONAR


_DEFAULT_RESOURCES: Final[ResourcesDict] = parse_obj_as(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class ThinDV2LocalhostClient(BaseThinClient):
BASE_ADDRESS: str = "http://localhost:8000"
BASE_ADDRESS: str = "http://localhost:8000" # NOSONAR

def __init__(self):
self.client = AsyncClient(timeout=Timeout(5))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class RunningDynamicServiceDetails(ServiceDetails):

@cached_property
def legacy_service_url(self) -> str:
return f"http://{self.host}:{self.internal_port}{self.basepath}"
return f"http://{self.host}:{self.internal_port}{self.basepath}" # NOSONAR

@classmethod
def from_scheduler_data(
Expand Down
2 changes: 1 addition & 1 deletion services/director/src/simcore_service_director/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _from_env_with_default(env: str, python_type, default):
# tracing
TRACING_ENABLED: bool = strtobool(os.environ.get("TRACING_ENABLED", "True"))
TRACING_ZIPKIN_ENDPOINT: str = os.environ.get(
"TRACING_ZIPKIN_ENDPOINT", "http://jaeger:9411"
"TRACING_ZIPKIN_ENDPOINT", "http://jaeger:9411" # NOSONAR
)

# resources: not taken from servicelib.resources since the director uses a fixed hash of that library
Expand Down
26 changes: 13 additions & 13 deletions services/director/src/simcore_service_director/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ async def _pass_port_to_service(
port,
route,
)
service_url = "http://" + service_name + "/" + route
service_url = "http://" + service_name + "/" + route # NOSONAR
query_string = {
"hostname": str(config.PUBLISHED_HOST_NAME),
"port": str(port),
Expand Down Expand Up @@ -534,17 +534,17 @@ async def _get_service_state(
log.debug("Getting service %s state", service_name)
tasks = await client.tasks.list(filters={"service": service_name})

async def _wait_for_tasks(tasks):
task_started_time = datetime.utcnow()
while (datetime.utcnow() - task_started_time) < timedelta(seconds=20):
tasks = await client.tasks.list(filters={"service": service_name})
# only keep the ones with the right service ID (we're being a bit picky maybe)
tasks = [x for x in tasks if x["ServiceID"] == service["ID"]]
if tasks:
return
await asyncio.sleep(1) # let other events happen too

await _wait_for_tasks(tasks)

# wait for tasks
task_started_time = datetime.utcnow()
while (datetime.utcnow() - task_started_time) < timedelta(seconds=20):
tasks = await client.tasks.list(filters={"service": service_name})
# only keep the ones with the right service ID (we're being a bit picky maybe)
tasks = [x for x in tasks if x["ServiceID"] == service["ID"]]
if tasks:
break
await asyncio.sleep(1) # let other events happen too

if not tasks:
return (ServiceState.FAILED, "getting state timed out")

Expand Down Expand Up @@ -1040,7 +1040,7 @@ async def get_service_details(app: web.Application, node_uuid: str) -> Dict:
async def _save_service_state(service_host_name: str, session: aiohttp.ClientSession):
response: ClientResponse
async with session.post(
url=f"http://{service_host_name}/state",
url=f"http://{service_host_name}/state", # NOSONAR
timeout=ServicesCommonSettings().director_dynamic_service_save_timeout,
) as response:
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def generate_dotenv(ctx: typer.Context, auto_password: bool = False):
) or generate_password(length=32)

settings = ApplicationSettings.create_from_envs(
INVITATIONS_OSPARC_URL="http://127.0.0.1:8000",
INVITATIONS_OSPARC_URL="http://127.0.0.1:8000", # NOSONAR
INVITATIONS_SECRET_KEY=Fernet.generate_key().decode(),
INVITATIONS_USERNAME=username,
INVITATIONS_PASSWORD=password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def _replace_uuids(node: Union[str, list, dict]) -> Union[str, list, dict]:
project_copy["ui"]["slideshow"] = _replace_uuids(
project_copy["ui"].get("slideshow", {})
)
if "mode" in project_copy["ui"]:
project_copy["ui"]["mode"] = project_copy["ui"]["mode"]

if clean_output_data:
FIELDS_TO_DELETE = ("outputs", "progress", "runHash")
for node_data in project_copy.get("workbench", {}).values():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class StaticWebserverModuleSettings(BaseCustomSettings):

# TODO: host/port
STATIC_WEBSERVER_URL: AnyHttpUrl = Field(
"http://static-webserver:8000",
"http://static-webserver:8000", # NOSONAR
description="url fort static content",
env=[
"STATIC_WEBSERVER_URL",
Expand Down