diff --git a/clearml_agent/backend_config/utils.py b/clearml_agent/backend_config/utils.py index 50148a7..284342c 100644 --- a/clearml_agent/backend_config/utils.py +++ b/clearml_agent/backend_config/utils.py @@ -52,6 +52,7 @@ def apply_files(config): target_fmt = data.get("target_format", "string") overwrite = bool(data.get("overwrite", True)) contents = data.get("contents") + mode = data.get("mode") target = Path(expanduser(expandvars(path))) @@ -110,3 +111,14 @@ def apply_files(config): except Exception as ex: print("Skipped [{}]: failed saving file {} ({})".format(key, target, ex)) continue + + try: + if mode: + if isinstance(mode, int): + mode = int(str(mode), 8) + else: + mode = int(mode, 8) + target.chmod(mode) + except Exception as ex: + print("Skipped [{}]: failed setting mode {} for {} ({})".format(key, mode, target, ex)) + continue diff --git a/docs/clearml.conf b/docs/clearml.conf index 5d48e89..57413bf 100644 --- a/docs/clearml.conf +++ b/docs/clearml.conf @@ -481,6 +481,7 @@ sdk { # target_format: format used to encode contents before writing into the target file. Supported values are json, # yaml, yml and bytes (in which case the file will be written in binary mode). Default is text mode. # overwrite: overwrite the target file in case it exists. Default is true. +# mode: set the file mode after writing. use an integer value or a string (e.g. 600 / 777 etc.) # # Example: # files {