From b78e9b904742073b30558ee06d417770aed0bc4d Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Fri, 9 Feb 2024 18:12:32 +0200 Subject: [PATCH] Fix regression causing an error when "secure" is provided in bucket settings --- clearml/backend_config/bucket_config.py | 2 ++ clearml/backend_interface/setupuploadmixin.py | 3 +++ clearml/backend_interface/task/populate.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/clearml/backend_config/bucket_config.py b/clearml/backend_config/bucket_config.py index bbb9eb1d..9b6228b5 100644 --- a/clearml/backend_config/bucket_config.py +++ b/clearml/backend_config/bucket_config.py @@ -45,6 +45,7 @@ class S3BucketConfig(object): use_credentials_chain=False, token="", extra_args=None, + secure=True, profile="" ): self.key = key @@ -54,6 +55,7 @@ class S3BucketConfig(object): self.region = region self.use_credentials_chain = use_credentials_chain self.extra_args = extra_args + self.secure = secure self.profile = profile def is_valid(self): diff --git a/clearml/backend_interface/setupuploadmixin.py b/clearml/backend_interface/setupuploadmixin.py index 00072bca..db767d9c 100644 --- a/clearml/backend_interface/setupuploadmixin.py +++ b/clearml/backend_interface/setupuploadmixin.py @@ -67,6 +67,7 @@ class SetupUploadMixin(object): multipart=True, # bool secure=True, # bool verify=True, # bool + profile=None # Optional[str] ): # type: (...) -> None """ @@ -85,6 +86,7 @@ class SetupUploadMixin(object): multipart. :param secure: Server supports HTTPS. Only required when using a Non-AWS S3 solution that only supports HTTPS. :param verify: Whether or not to verify SSL certificates. + :param profile: The AWS profile Only required when using a Non-AWS S3 solution that only supports HTTPS with self-signed certificate. """ self._bucket_config = S3BucketConfig( # noqa @@ -98,6 +100,7 @@ class SetupUploadMixin(object): multipart=multipart, secure=secure, verify=verify, + profile=profile ) StorageHelper.add_aws_configuration(self._bucket_config, log=self.log) self.storage_uri = StorageHelper.get_aws_storage_uri_from_config(self._bucket_config) diff --git a/clearml/backend_interface/task/populate.py b/clearml/backend_interface/task/populate.py index 26bf4404..30181e15 100644 --- a/clearml/backend_interface/task/populate.py +++ b/clearml/backend_interface/task/populate.py @@ -213,6 +213,8 @@ class CreateAndPopulate(object): task_state['script']['requirements'] = repo_info.script.get('requirements') or {} if self.cwd: self.cwd = self.cwd + # cwd should be relative to the repo_root, but we need the full path + # (repo_root + cwd) in order to resolve the entry point cwd = (Path(repo_info.script['repo_root']) / self.cwd).as_posix() if not Path(cwd).is_dir(): @@ -220,7 +222,9 @@ class CreateAndPopulate(object): entry_point = \ Path(repo_info.script['repo_root']) / repo_info.script['working_dir'] / repo_info.script[ 'entry_point'] + # resolve entry_point relative to the current working directory entry_point = entry_point.relative_to(cwd).as_posix() + # restore cwd - make it relative to the repo_root again cwd = Path(cwd).relative_to(repo_info.script['repo_root']).as_posix() task_state['script']['entry_point'] = entry_point or "" task_state['script']['working_dir'] = cwd or "."