Bläddra i källkod

HUE-3523 [oozie] Modify find_jobs_with_no_doc method to exclude jobs with no name

krish 9 år sedan
förälder
incheckning
b85823d
1 ändrade filer med 6 tillägg och 3 borttagningar
  1. 6 3
      desktop/core/src/desktop/models.py

+ 6 - 3
desktop/core/src/desktop/models.py

@@ -279,6 +279,9 @@ class DocumentManager(models.Manager):
     def find_jobs_with_no_doc(model):
       return model.objects.filter(doc__isnull=True).select_related('owner')
 
+    def find_oozie_jobs_with_no_doc(model):
+      return model.objects.filter(doc__isnull=True).exclude(name__exact='').select_related('owner')
+
     table_names = connection.introspection.table_names()
 
     try:
@@ -290,9 +293,9 @@ class DocumentManager(models.Manager):
           Bundle._meta.db_table in table_names:
         with transaction.atomic():
           for job in chain(
-              find_jobs_with_no_doc(Workflow),
-              find_jobs_with_no_doc(Coordinator),
-              find_jobs_with_no_doc(Bundle)):
+              find_oozie_jobs_with_no_doc(Workflow),
+              find_oozie_jobs_with_no_doc(Coordinator),
+              find_oozie_jobs_with_no_doc(Bundle)):
             doc = Document.objects.link(job, owner=job.owner, name=job.name, description=job.description)
 
             if job.is_trashed: