Skip to content

Commit

Permalink
Merge branch 'main' into andrea/3392-add-polybox-switchdrive-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius authored Dec 3, 2024
2 parents 8744a6b + abc8ef5 commit 6c463aa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- closed

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -47,6 +47,11 @@ jobs:
url: https://renku-ci-ds-${{ github.event.number }}.dev.renku.ch
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.RENKU_DOCKER_USERNAME }}
password: ${{ secrets.RENKU_DOCKER_PASSWORD }}
- name: Find deplyoment url
uses: peter-evans/find-comment@v3
id: deploymentUrlMessage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/save_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
DEVCONTAINER_IMAGE_CACHE: ghcr.io/swissdatasciencecenter/renku-data-services/devcontainer

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ on:
- "v*"
pull_request:
branches:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
DEVCONTAINER_REGISTRY: ghcr.io
DEVCONTAINER_IMAGE_NAME: ${{ github.repository }}/devcontainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async def get_server(self, name: str) -> _SessionType | None:
except NotFoundError:
return None
except ServerError as err:
if err.status not in [400, 404]:
if err.response is None or err.response.status_code not in [400, 404]:
logging.exception(f"Cannot get server {name} because of {err}")
raise IntermittentError(f"Cannot get server {name} from the k8s API.")
return None
Expand All @@ -193,16 +193,11 @@ async def list_servers(self, label_selector: Optional[str] = None) -> list[_Sess
try:
servers = await self._kr8s_type.list(namespace=self.namespace, label_selector=label_selector)
except ServerError as err:
if err.status not in [400, 404]:
if err.response is None or err.response.status_code not in [400, 404]:
logging.exception(f"Cannot list servers because of {err}")
raise IntermittentError(f"Cannot list servers from the k8s API with selector {label_selector}.")
return []
output: list[_SessionType]
if isinstance(servers, APIObject):
output = [self.server_type.model_validate(servers.to_dict())]
else:
output = [self.server_type.model_validate(server.to_dict()) for server in servers]

output: list[_SessionType] = [self.server_type.model_validate(server.to_dict()) for server in servers]
return output

async def patch_image_pull_secret(self, server_name: str, gitlab_token: GitlabToken) -> None:
Expand Down
13 changes: 6 additions & 7 deletions components/renku_data_services/notebooks/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,15 @@ async def _handler(
# TODO: Add types for saved and unsaved resource class
resource_class_id = cast(int, resource_class.id)
else:
resource_class = await self.rp_repo.get_resource_class(user, resource_class_id)
resource_class = await self.rp_repo.get_resource_class(user, body.resource_class_id)
# TODO: Add types for saved and unsaved resource class
resource_class_id = cast(int, resource_class.id)
resource_class_id = body.resource_class_id
quota = resource_class.quota
await self.nb_config.crc_validator.validate_class_storage(user, resource_class_id, body.disk_storage)
work_dir_fallback = PurePosixPath("/home/jovyan")
work_dir = environment.working_directory or image_workdir or work_dir_fallback
storage_mount_fallback = work_dir / "work"
storage_mount = launcher.environment.mount_directory or storage_mount_fallback
# TODO: Wait for pitch on users secrets to implement this
# user_secrets: K8sUserSecrets | None = None
# if body.user_secrets:
Expand Down Expand Up @@ -344,7 +345,7 @@ async def _handler(
quiet=True,
)
if csr.target_path is not None and not PurePosixPath(csr.target_path).is_absolute():
csr.target_path = (work_dir / csr.target_path).as_posix()
csr.target_path = (storage_mount / csr.target_path).as_posix()
dcs[csr_id] = dcs[csr_id].with_override(csr)
git_providers = await self.nb_config.git_provider_helper.get_providers(user=user)
repositories: list[Repository] = []
Expand Down Expand Up @@ -405,7 +406,7 @@ async def _handler(
config=self.nb_config,
repositories=repositories,
git_providers=git_providers,
workspace_mount_path=launcher.environment.mount_directory or storage_mount_fallback,
workspace_mount_path=storage_mount,
work_dir=work_dir,
)
if git_clone is not None:
Expand Down Expand Up @@ -464,9 +465,7 @@ async def _handler(
storage=Storage(
className=self.nb_config.sessions.storage.pvs_storage_class,
size=str(body.disk_storage) + "G",
mountPath=environment.mount_directory.as_posix()
if environment.mount_directory
else storage_mount_fallback.as_posix(),
mountPath=storage_mount.as_posix(),
),
workingDir=work_dir.as_posix(),
runAsUser=environment.uid,
Expand Down

0 comments on commit 6c463aa

Please sign in to comment.