File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -768,7 +768,8 @@ def write_cluster_config(
768
768
769
769
yaml_path = _get_yaml_path_from_cluster_name (cluster_name )
770
770
771
- # Use a tmp file path to avoid incomplete YAML file being re-used in the future.
771
+ # Use a tmp file path to avoid incomplete YAML file being re-used in the
772
+ # future.
772
773
tmp_yaml_path = yaml_path + '.tmp'
773
774
tmp_yaml_path = fill_template (
774
775
cluster_config_template ,
@@ -778,6 +779,12 @@ def write_cluster_config(
778
779
'cluster_name' : cluster_name ,
779
780
'num_nodes' : num_nodes ,
780
781
'disk_size' : to_provision .disk_size ,
782
+ # If the current code is run by controller, propagate the real
783
+ # calling user which should've been passed in as the
784
+ # SKYPILOT_USER env var (see spot-controller.yaml.j2).
785
+ 'user' : os .environ .get ('SKYPILOT_USER' , getpass .getuser ()),
786
+
787
+ # AWS only:
781
788
# Temporary measure, as deleting per-cluster SGs is too slow.
782
789
# See https://github.com/skypilot-org/skypilot/pull/742.
783
790
# Generate the name of the security group we're looking for.
Original file line number Diff line number Diff line change @@ -527,6 +527,7 @@ def spot_launch(
527
527
'disable_logging' : env_options .Options .DISABLE_LOGGING .get (),
528
528
'logging_user_hash' : common_utils .get_user_hash (),
529
529
'retry_until_up' : retry_until_up ,
530
+ 'user' : os .environ .get ('USER' , None ),
530
531
},
531
532
output_prefix = spot .SPOT_CONTROLLER_YAML_PREFIX )
532
533
controller_task = task_lib .Task .from_yaml (yaml_path )
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ available_node_types:
43
43
# SpotOptions:
44
44
# MaxPrice: MAX_HOURLY_PRICE
45
45
{% endif %}
46
+ TagSpecifications:
47
+ - ResourceType: instance
48
+ Tags:
49
+ - Key: skypilot-user
50
+ Value: {{ user }}
46
51
{% if num_nodes > 1 %}
47
52
ray.worker.default:
48
53
min_workers: {{num_nodes - 1}}
@@ -65,6 +70,11 @@ available_node_types:
65
70
# SpotOptions:
66
71
# MaxPrice: MAX_HOURLY_PRICE
67
72
{% endif %}
73
+ TagSpecifications:
74
+ - ResourceType: instance
75
+ Tags:
76
+ - Key: skypilot-user
77
+ Value: {{ user }}
68
78
{% - endif %}
69
79
70
80
head_node_type: ray.head.default
Original file line number Diff line number Diff line change 39
39
40
40
envs:
41
41
SKYPILOT_USAGE_USER_ID: {{logging_user_hash}}
42
+ SKYPILOT_USER: {{user}}
42
43
{% if is_dev %}
43
44
SKYPILOT_DEV: 1
44
45
{% endif %}
You can’t perform that action at this time.
0 commit comments