Skip to content

Commit

Permalink
Merge branch 'develop' into fix/3659-fix-image-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius authored Jan 4, 2024
2 parents 0ddea38 + d74cc72 commit 81a3133
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ module = [
"ruamel",
"rq",
"shellingham",
"setuptools",
"toil.*",
"tqdm",
"urllib3.*",
Expand Down
8 changes: 8 additions & 0 deletions renku/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@

from renku.version import __template_version__, __version__

# distutils is deprecated and fully replaced by setuptools. we don't depend on either, but some of our
# dependencies do and if distutils gets imported before setuptools, we get an annoying warning.
# By forcing the import here first, we prevent that warning and ensure the setuptools version is used.
try:
import setuptools # noqa: F401 # type: ignore
except ImportError:
pass


class LoaderWrapper(importlib.abc.Loader):
"""Wrap an importlib loader and add the loaded module to sys.modules with an additional name."""
Expand Down
4 changes: 3 additions & 1 deletion renku/core/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ def session_start(
if image_name is None:
tag = project_context.repository.head.commit.hexsha[:7]
repo_host = get_image_repository_host()
image_name = f"{project_name}:{tag}"
image_name = f"{project_name.lower()}:{tag}"
if repo_host:
image_name = f"{repo_host}/{image_name}"
if image_name.lower() != image_name:
raise errors.SessionStartError(f"Image name '{image_name}' cannot contain upper-case letters.")

force_build_image = provider_api.force_build_image(**kwargs)

Expand Down
2 changes: 1 addition & 1 deletion renku/ui/service/controllers/datasets_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def renku_op(self):

creators: Union[NoValueType, List[Person]]
if "creators" in self.ctx:
creators, warnings = construct_creators(self.ctx.get("creators")) # type: ignore
creators, warnings = construct_creators(self.ctx.get("creators"), ignore_email=True) # type: ignore
else:
creators = NO_VALUE

Expand Down
3 changes: 3 additions & 0 deletions renku/ui/service/controllers/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Renku service version controller."""
import os

from renku import __version__
from renku.core.migration.migrate import SUPPORTED_PROJECT_VERSION
from renku.ui.service.controllers.api.abstract import ServiceCtrl
Expand All @@ -33,6 +35,7 @@ def to_response(self, minimum_version, maximum_version):
{
"latest_version": __version__,
"supported_project_version": SUPPORTED_PROJECT_VERSION,
"cli_version": os.environ.get("RENKU_PROJECT_DEFAULT_CLI_VERSION") or __version__,
"minimum_api_version": minimum_version.name,
"maximum_api_version": maximum_version.name,
},
Expand Down
15 changes: 14 additions & 1 deletion renku/ui/service/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _handle_sentry(self):
sentry_target = sentry_url.netloc.split("@")[-1]
# NOTE: sentry doesn't support a global search. A proper link would require the specific org
sentry = f"{sentry_url.scheme }://{sentry_target}/organizations/sentry?query={sentry}"
except Exception:
except Exception: # nosec
pass
except KeyError as e:
sentry = f"Unexpected error while reporting to Sentry: {str(e)}"
Expand Down Expand Up @@ -348,6 +348,19 @@ def __init__(self, exception=None):
super().__init__(exception=exception)


class UserDatasetsNotFoundError(ServiceError):
"""Dataset couldn't be found in project."""

code = SVC_ERROR_USER + 133
userMessage = (
"The dataset doesn't exist in the project. Please check your inputs or create the target dataset first."
)
devMessage = "The dataset couldn't be found in the project."

def __init__(self, exception=None):
super().__init__(exception=exception)


class UserOutdatedProjectError(ServiceError):
"""The operation can be done only after updating the target project."""

Expand Down
4 changes: 4 additions & 0 deletions renku/ui/service/views/error_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
AuthenticationError,
DatasetExistsError,
DatasetImageError,
DatasetNotFound,
DockerfileUpdateError,
GitCommandError,
GitError,
Expand Down Expand Up @@ -65,6 +66,7 @@
ProgramUpdateProjectError,
ServiceError,
UserDatasetsMultipleImagesError,
UserDatasetsNotFoundError,
UserDatasetsUnlinkError,
UserDatasetsUnreachableImageError,
UserInvalidGenericFieldsError,
Expand Down Expand Up @@ -368,6 +370,8 @@ def decorated_function(*args, **kwargs):
if "".join(value) == "Field may not be null.":
raise UserMissingFieldError(e, key)
raise
except DatasetNotFound as e:
raise UserDatasetsNotFoundError(e)
except DatasetExistsError as e:
raise IntermittentDatasetExistsError(e)
except RenkuException as e:
Expand Down

0 comments on commit 81a3133

Please sign in to comment.