Browse Source

[computes] removed admissiond from impala readiness check

admissiond check is no longer needed.
also fixed a few other bool conversions.

the `is_ready` field currently has minimal effect on the UI. We return
the results sorting the computes with ready ones on the top while
non-ready ones at the bottom. In future, we should update the UI to
indicate if a compute is ready to accept queries or not.

This change also makes the compute.is_ready nullable/optional because
it is not in full use yet and should not effect inserts and updates.
Amit Srivastava 10 months ago
parent
commit
d610479c8d

+ 18 - 0
apps/beeswax/src/beeswax/migrations/0004_alter_compute_is_ready.py

@@ -0,0 +1,18 @@
+# Generated by Django 3.2.25 on 2025-01-09 11:39
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('beeswax', '0003_compute_namespace'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='compute',
+            name='is_ready',
+            field=models.BooleanField(default=True, null=True),
+        ),
+    ]

+ 1 - 1
apps/beeswax/src/beeswax/models.py

@@ -651,7 +651,7 @@ class Compute(models.Model):
       default='sqlalchemy'
   )
   namespace = models.ForeignKey(Namespace, on_delete=models.CASCADE, null=True)
-  is_ready = models.BooleanField(default=True)
+  is_ready = models.BooleanField(default=True, null=True)
   external_id = models.CharField(max_length=255, null=True, db_index=True)
   ldap_groups_json = models.TextField(default='[]')
   settings = models.TextField(default='{}')

+ 3 - 5
desktop/core/src/desktop/management/commands/sync_warehouses.py

@@ -170,12 +170,10 @@ def populate_impala(namespace, impala):
   catalogd_dep = next((d for d in deployments if d.metadata.labels['app'] == 'catalogd'), None)
   catalogd_stfs = next((s for s in stfs if s.metadata.labels['app'] == 'catalogd'), None)
   statestore_dep = next((d for d in deployments if d.metadata.labels['app'] == 'statestored'), None)
-  admissiond_dep = next((d for d in deployments if d.metadata.labels['app'] == 'admissiond'), None)
 
   impala['is_ready'] = bool(((catalogd_dep and catalogd_dep.status.ready_replicas) or (
         catalogd_stfs and catalogd_stfs.status.ready_replicas))
-                     and (statestore_dep and statestore_dep.status.ready_replicas)
-                     and (admissiond_dep and admissiond_dep.status.ready_replicas))
+                     and (statestore_dep and statestore_dep.status.ready_replicas))
 
   if not impala['is_ready']:
     LOG.info("Impala %s not ready" % namespace)
@@ -187,12 +185,12 @@ def populate_impala(namespace, impala):
     update_impala_configs(namespace, impala, 'impala-proxy.%s.svc.cluster.local' % namespace)
   else:
     coordinator = next((s for s in stfs if s.metadata.labels['app'] == 'coordinator'), None)
-    impala['is_ready'] = impala['is_ready'] and (coordinator and coordinator.status.ready_replicas)
+    impala['is_ready'] = bool(impala['is_ready'] and (coordinator and coordinator.status.ready_replicas))
 
     hs2_stfs = next((s for s in stfs if s.metadata.labels['app'] == 'hiveserver2'), None)
     if hs2_stfs:
       # Impala is running with UA
-      impala['is_ready'] = impala['is_ready'] and hs2_stfs.status.ready_replicas
+      impala['is_ready'] = bool(impala['is_ready'] and hs2_stfs.status.ready_replicas)
       update_hive_configs(namespace, impala, 'hiveserver2-service.%s.svc.cluster.local' % namespace)
     else:
       # Impala is not running with UA