@@ -808,12 +808,19 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
808
808
809
809
await fetch_crn_list () # Precache CRN list
810
810
scheduler_responses = dict (await asyncio .gather (* [fetch_vm_info (message ) for message in messages ]))
811
- uninitialized_confidential_found = False
811
+ uninitialized_confidential_found = []
812
+ unallocated_payg_found = []
812
813
async with AlephHttpClient (api_server = settings .API_HOST ) as client :
813
814
for message in messages :
814
815
info = scheduler_responses [message .item_hash ]
816
+
817
+ is_hold = info ["payment" ] == PaymentType .hold .value
818
+ if not is_hold and info ["ipv6_logs" ] == help_strings .VM_NOT_READY :
819
+ unallocated_payg_found .append (message .item_hash )
815
820
if info ["confidential" ] and info ["ipv6_logs" ] == help_strings .VM_NOT_READY :
816
- uninitialized_confidential_found = True
821
+ uninitialized_confidential_found .append (message .item_hash )
822
+
823
+ # 1st Column
817
824
name = Text (
818
825
(
819
826
message .content .metadata ["name" ]
@@ -831,7 +838,7 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
831
838
"Payment: " ,
832
839
Text (
833
840
info ["payment" ].capitalize ().ljust (12 ),
834
- style = "red" if info [ "payment" ] == PaymentType . hold . value else "orange3" ,
841
+ style = "red" if is_hold else "orange3" ,
835
842
),
836
843
)
837
844
confidential = Text .assemble (
@@ -847,7 +854,7 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
847
854
payer = Text .assemble ("\n Payer: " , Text (str (message .content .address ), style = "orange1" ))
848
855
price : PriceResponse = await client .get_program_price (message .item_hash )
849
856
required_tokens = Decimal (price .required_tokens )
850
- if price . payment_type == PaymentType . hold . value :
857
+ if is_hold :
851
858
aleph_price = Text (f"{ displayable_amount (required_tokens , decimals = 3 )} (fixed)" , style = "violet" )
852
859
else :
853
860
psec = f"{ displayable_amount (required_tokens , decimals = 8 )} /sec"
@@ -856,6 +863,7 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
856
863
pmonth = f"{ displayable_amount (2628000 * required_tokens , decimals = 3 )} /month"
857
864
aleph_price = Text .assemble (psec , " | " , phour , " | " , pday , " | " , pmonth , style = "violet" )
858
865
cost = Text .assemble ("\n $ALEPH: " , aleph_price )
866
+
859
867
instance = Text .assemble (
860
868
"Item Hash ↓\t Name: " ,
861
869
name ,
@@ -870,6 +878,8 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
870
878
payer ,
871
879
cost ,
872
880
)
881
+
882
+ # 2nd Column
873
883
hypervisor = safe_getattr (message , "content.environment.hypervisor" )
874
884
specs = [
875
885
f"vCPU: [magenta3]{ message .content .resources .vcpus } [/magenta3]\n " ,
@@ -884,6 +894,8 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
884
894
specs += [f"• [green]{ gpu .vendor } , { gpu .device_name } [green]" ]
885
895
specs += ["[/bright_yellow]" ]
886
896
specifications = Text .from_markup ("" .join (specs ))
897
+
898
+ # 3rd Column
887
899
status_column = Text .assemble (
888
900
Text .assemble (
889
901
Text ("Allocation: " , style = "blue" ),
@@ -936,20 +948,33 @@ async def _show_instances(messages: builtins.list[InstanceMessage]):
936
948
console .print (table )
937
949
938
950
infos = [Text .from_markup (f"[bold]Address:[/bold] [bright_cyan]{ messages [0 ].sender } [/bright_cyan]" )]
951
+ if unallocated_payg_found :
952
+ unallocated_payg_found_str = "\n " .join (unallocated_payg_found )
953
+ infos += [
954
+ Text .assemble (
955
+ Text .from_markup ("\n \n You have unallocated/unstarted instance(s) with active flows:\n " ),
956
+ Text .from_markup (f"[bright_red]{ unallocated_payg_found_str } [/bright_red]" ),
957
+ Text .from_markup (
958
+ "\n [italic]↳[/italic] [orange3]Recommended action:[/orange3] allocate + start, or delete them."
959
+ ),
960
+ )
961
+ ]
939
962
if uninitialized_confidential_found :
963
+ uninitialized_confidential_found_str = "\n " .join (uninitialized_confidential_found )
940
964
infos += [
941
965
Text .assemble (
942
- "\n \n Boot uninitialized/unstarted confidential instances with:\n " ,
966
+ "\n \n Boot unallocated/unstarted confidential instance(s):\n " ,
967
+ Text .from_markup (f"[grey50]{ uninitialized_confidential_found_str } [/grey50]" ),
943
968
Text .from_markup (
944
- "↳ aleph instance confidential [bright_cyan]<vm-item-hash>[/bright_cyan]" , style = "italic"
969
+ "\n ↳ aleph instance confidential [bright_cyan]<vm-item-hash>[/bright_cyan]" , style = "italic"
945
970
),
946
971
)
947
972
]
948
973
infos += [
949
974
Text .assemble (
950
975
"\n \n Connect to an instance with:\n " ,
951
976
Text .from_markup (
952
- "↳ ssh root@[yellow]<ipv6-address>[/yellow] [-i [orange3]<ssh-private-key-file>[/orange3]]" ,
977
+ "↳ ssh root@[yellow]<ipv6-address>[/yellow] [-i [orange3]<ssh-private-key-file>[/orange3]]" ,
953
978
style = "italic" ,
954
979
),
955
980
)
0 commit comments