浏览代码

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

krish 9 年之前
父节点
当前提交
b85823d5c0
共有 1 个文件被更改,包括 6 次插入3 次删除
  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: