This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 692bab3bc [DATALAB-994]: Added conveying custom_tag for instances
     new 4bc6d2b13 Merge pull request #1704 from OleksandrRepnikov/DATALAB-994
692bab3bc is described below

commit 692bab3bc8ee9d6c88a6292ab626d43455465ccd
Author: orepnikov <[email protected]>
AuthorDate: Fri Sep 2 13:28:24 2022 +0300

    [DATALAB-994]: Added conveying custom_tag for instances
---
 .../src/general/scripts/aws/common_prepare_notebook.py    | 15 +++++++++------
 .../src/general/scripts/azure/common_prepare_notebook.py  |  3 +++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git 
a/infrastructure-provisioning/src/general/scripts/aws/common_prepare_notebook.py
 
b/infrastructure-provisioning/src/general/scripts/aws/common_prepare_notebook.py
index e56f9c8c9..b16dfcd86 100644
--- 
a/infrastructure-provisioning/src/general/scripts/aws/common_prepare_notebook.py
+++ 
b/infrastructure-provisioning/src/general/scripts/aws/common_prepare_notebook.py
@@ -72,7 +72,9 @@ if __name__ == "__main__":
             notebook_config['exploratory_name'] = 
os.environ['exploratory_name'].lower()
         except:
             notebook_config['exploratory_name'] = ''
-
+        notebook_config['custom_tag'] = 
json.loads(os.environ['tags'].replace("'", '"'))['custom_tag']
+        if notebook_config['custom_tag']:
+            notebook_config['custom_tag'] = 
';custom_tag:{}'.format(notebook_config['custom_tag'])
         notebook_config['instance_type'] = 
os.environ['aws_notebook_instance_type']
         notebook_config['key_name'] = os.environ['conf_key_name']
         notebook_config['instance_name'] = 
'{}-{}-{}-nb-{}-{}'.format(notebook_config['service_base_name'],
@@ -134,11 +136,12 @@ if __name__ == "__main__":
             json.dump(data, f)
 
         try:
-            os.environ['conf_additional_tags'] = 
'{2};project_tag:{0};endpoint_tag:{1};'.format(
-                notebook_config['project_name'], 
notebook_config['endpoint_name'], os.environ['conf_additional_tags'])
-        except KeyError:
-            os.environ['conf_additional_tags'] = 
'project_tag:{0};endpoint_tag:{1}'.format(
-                notebook_config['project_name'], 
notebook_config['endpoint_name'])
+            os.environ['conf_additional_tags'] = 
'{2};project_tag:{0};endpoint_tag:{1}{3}'.format(
+                notebook_config['project_name'], 
notebook_config['endpoint_name'], os.environ['conf_additional_tags'],
+                notebook_config['custom_tag'])
+        except KeyError as ex:
+            os.environ['conf_additional_tags'] = 
'project_tag:{0};endpoint_tag:{1}{2}'.format(
+                notebook_config['project_name'], 
notebook_config['endpoint_name'], notebook_config['custom_tag'])
 
         logging.info('Additional tags will be added: 
{}'.format(os.environ['conf_additional_tags']))
     except Exception as err:
diff --git 
a/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py
 
b/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py
index be15d9b87..122be0e39 100644
--- 
a/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py
+++ 
b/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py
@@ -68,6 +68,9 @@ if __name__ == "__main__":
                                    "endpoint_tag": 
notebook_config['endpoint_tag'],
                                    "Exploratory": 
notebook_config['exploratory_name'],
                                    "product": "datalab"}
+        notebook_config['custom_tag'] = 
json.loads(os.environ['tags'].replace("'", '"'))['custom_tag']
+        if notebook_config['custom_tag']:
+            notebook_config['tags']['custom_tag'] = 
notebook_config['custom_tag']
         notebook_config['network_interface_name'] = 
notebook_config['instance_name'] + "-nif"
         notebook_config['security_group_name'] = 
'{}-{}-{}-nb-sg'.format(notebook_config['service_base_name'],
                                                                          
notebook_config['project_name'],


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to