Explorar o código

HUE-1656 [oozie] Make data fully integrated in the API part 1

Now we just need to add a ko.obervable for the new fields we want to
edit and that's it.
Romain Rigaux %!s(int64=12) %!d(string=hai) anos
pai
achega
71d3631f8e

+ 12 - 4
apps/oozie/src/oozie/migrations/0025_auto__add_field_node_data.py → apps/oozie/src/oozie/migrations/0023_auto__add_field_node_data__add_field_job_data.py

@@ -13,11 +13,19 @@ class Migration(SchemaMigration):
                       self.gf('django.db.models.fields.TextField')(default='{}', blank=True),
                       keep_default=False)
 
+        # Adding field 'Job.data'
+        db.add_column('oozie_job', 'data',
+                      self.gf('django.db.models.fields.TextField')(default='{}', blank=True),
+                      keep_default=False)
+
 
     def backwards(self, orm):
         # Deleting field 'Node.data'
         db.delete_column('oozie_node', 'data')
 
+        # Deleting field 'Job.data'
+        db.delete_column('oozie_job', 'data')
+
 
     models = {
         'auth.group': {
@@ -79,7 +87,7 @@ class Migration(SchemaMigration):
             'Meta': {'object_name': 'Bundle', '_ormbases': ['oozie.Job']},
             'coordinators': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['oozie.Coordinator']", 'through': "orm['oozie.BundledCoordinator']", 'symmetrical': 'False'}),
             'job_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Job']", 'unique': 'True', 'primary_key': 'True'}),
-            'kick_off_time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 11, 0, 0)'})
+            'kick_off_time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 17, 0, 0)'})
         },
         'oozie.bundledcoordinator': {
             'Meta': {'object_name': 'BundledCoordinator'},
@@ -91,13 +99,13 @@ class Migration(SchemaMigration):
         'oozie.coordinator': {
             'Meta': {'object_name': 'Coordinator', '_ormbases': ['oozie.Job']},
             'concurrency': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
-            'end': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 14, 0, 0)'}),
+            'end': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 20, 0, 0)'}),
             'execution': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
             'frequency_number': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}),
             'frequency_unit': ('django.db.models.fields.CharField', [], {'default': "'days'", 'max_length': '20'}),
             'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
             'job_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Job']", 'unique': 'True', 'primary_key': 'True'}),
-            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 11, 0, 0)'}),
+            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 17, 0, 0)'}),
             'throttle': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
             'timeout': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
             'timezone': ('django.db.models.fields.CharField', [], {'default': "'America/Los_Angeles'", 'max_length': '24'}),
@@ -129,7 +137,7 @@ class Migration(SchemaMigration):
             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
             'instance_choice': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '10'}),
             'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 11, 0, 0)'}),
+            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 17, 0, 0)'}),
             'timezone': ('django.db.models.fields.CharField', [], {'default': "'America/Los_Angeles'", 'max_length': '24'}),
             'uri': ('django.db.models.fields.CharField', [], {'default': "'/data/${YEAR}${MONTH}${DAY}'", 'max_length': '1024'})
         },

+ 0 - 349
apps/oozie/src/oozie/migrations/0024_auto__del_field_job_doc__add_field_job_data.py

@@ -1,349 +0,0 @@
-# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        # Deleting field 'Job.doc'
-        db.delete_column('oozie_job', 'doc_id')
-
-        # Adding field 'Job.data'
-        db.add_column('oozie_job', 'data',
-                      self.gf('django.db.models.fields.TextField')(default='{}'),
-                      keep_default=False)
-
-
-    def backwards(self, orm):
-        # Adding field 'Job.doc'
-        db.add_column('oozie_job', 'doc',
-                      self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='oozie_doc2', null=True, to=orm['desktop.Document']),
-                      keep_default=False)
-
-        # Deleting field 'Job.data'
-        db.delete_column('oozie_job', 'data')
-
-
-    models = {
-        'auth.group': {
-            'Meta': {'object_name': 'Group'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
-            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
-        },
-        'auth.permission': {
-            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
-            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
-        },
-        'auth.user': {
-            'Meta': {'object_name': 'User'},
-            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
-            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
-            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
-            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
-            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
-            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
-            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
-            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
-            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
-        },
-        'contenttypes.contenttype': {
-            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
-            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
-        },
-        'desktop.document': {
-            'Meta': {'object_name': 'Document'},
-            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
-            'description': ('django.db.models.fields.TextField', [], {'default': "''"}),
-            'extra': ('django.db.models.fields.TextField', [], {'default': "''"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
-            'name': ('django.db.models.fields.TextField', [], {'default': "''"}),
-            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
-            'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'doc_owner'", 'to': "orm['auth.User']"}),
-            'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['desktop.DocumentTag']", 'db_index': 'True', 'symmetrical': 'False'}),
-            'version': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'})
-        },
-        'desktop.documenttag': {
-            'Meta': {'object_name': 'DocumentTag'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
-            'tag': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
-        },
-        'oozie.bundle': {
-            'Meta': {'object_name': 'Bundle', '_ormbases': ['oozie.Job']},
-            'coordinators': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['oozie.Coordinator']", 'through': "orm['oozie.BundledCoordinator']", 'symmetrical': 'False'}),
-            'job_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Job']", 'unique': 'True', 'primary_key': 'True'}),
-            'kick_off_time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 9, 0, 0)'})
-        },
-        'oozie.bundledcoordinator': {
-            'Meta': {'object_name': 'BundledCoordinator'},
-            'bundle': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Bundle']"}),
-            'coordinator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Coordinator']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'parameters': ('django.db.models.fields.TextField', [], {'default': '\'[{"name":"oozie.use.system.libpath","value":"true"}]\''})
-        },
-        'oozie.coordinator': {
-            'Meta': {'object_name': 'Coordinator', '_ormbases': ['oozie.Job']},
-            'concurrency': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
-            'end': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 12, 0, 0)'}),
-            'execution': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
-            'frequency_number': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}),
-            'frequency_unit': ('django.db.models.fields.CharField', [], {'default': "'days'", 'max_length': '20'}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Job']", 'unique': 'True', 'primary_key': 'True'}),
-            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 9, 0, 0)'}),
-            'throttle': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
-            'timeout': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
-            'timezone': ('django.db.models.fields.CharField', [], {'default': "'America/Los_Angeles'", 'max_length': '24'}),
-            'workflow': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Workflow']", 'null': 'True'})
-        },
-        'oozie.datainput': {
-            'Meta': {'object_name': 'DataInput'},
-            'coordinator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Coordinator']"}),
-            'dataset': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Dataset']", 'unique': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'})
-        },
-        'oozie.dataoutput': {
-            'Meta': {'object_name': 'DataOutput'},
-            'coordinator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Coordinator']"}),
-            'dataset': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Dataset']", 'unique': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'})
-        },
-        'oozie.dataset': {
-            'Meta': {'object_name': 'Dataset'},
-            'advanced_end_instance': ('django.db.models.fields.CharField', [], {'default': "'0'", 'max_length': '128', 'blank': 'True'}),
-            'advanced_start_instance': ('django.db.models.fields.CharField', [], {'default': "'0'", 'max_length': '128'}),
-            'coordinator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Coordinator']"}),
-            'description': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}),
-            'done_flag': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'blank': 'True'}),
-            'frequency_number': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}),
-            'frequency_unit': ('django.db.models.fields.CharField', [], {'default': "'days'", 'max_length': '20'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'instance_choice': ('django.db.models.fields.CharField', [], {'default': "'default'", 'max_length': '10'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'start': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 9, 0, 0)'}),
-            'timezone': ('django.db.models.fields.CharField', [], {'default': "'America/Los_Angeles'", 'max_length': '24'}),
-            'uri': ('django.db.models.fields.CharField', [], {'default': "'/data/${YEAR}${MONTH}${DAY}'", 'max_length': '1024'})
-        },
-        'oozie.decision': {
-            'Meta': {'object_name': 'Decision'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.decisionend': {
-            'Meta': {'object_name': 'DecisionEnd'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.distcp': {
-            'Meta': {'object_name': 'DistCp'},
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"})
-        },
-        'oozie.email': {
-            'Meta': {'object_name': 'Email'},
-            'body': ('django.db.models.fields.TextField', [], {'default': "''"}),
-            'cc': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'subject': ('django.db.models.fields.TextField', [], {'default': "''"}),
-            'to': ('django.db.models.fields.TextField', [], {'default': "''"})
-        },
-        'oozie.end': {
-            'Meta': {'object_name': 'End'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.fork': {
-            'Meta': {'object_name': 'Fork'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.fs': {
-            'Meta': {'object_name': 'Fs'},
-            'chmods': ('django.db.models.fields.TextField', [], {'default': "'[]'", 'blank': 'True'}),
-            'deletes': ('django.db.models.fields.TextField', [], {'default': "'[]'", 'blank': 'True'}),
-            'mkdirs': ('django.db.models.fields.TextField', [], {'default': "'[]'", 'blank': 'True'}),
-            'moves': ('django.db.models.fields.TextField', [], {'default': "'[]'", 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'touchzs': ('django.db.models.fields.TextField', [], {'default': "'[]'", 'blank': 'True'})
-        },
-        'oozie.generic': {
-            'Meta': {'object_name': 'Generic'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'xml': ('django.db.models.fields.TextField', [], {'default': "''"})
-        },
-        'oozie.history': {
-            'Meta': {'object_name': 'History'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Job']"}),
-            'oozie_job_id': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
-            'properties': ('django.db.models.fields.TextField', [], {}),
-            'submission_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
-            'submitter': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
-        },
-        'oozie.hive': {
-            'Meta': {'object_name': 'Hive'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': '\'[{"name":"oozie.hive.defaults","value":"hive-site.xml"}]\''}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'script_path': ('django.db.models.fields.CharField', [], {'max_length': '256'})
-        },
-        'oozie.java': {
-            'Meta': {'object_name': 'Java'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'args': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
-            'capture_output': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'jar_path': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
-            'java_opts': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'main_class': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"})
-        },
-        'oozie.job': {
-            'Meta': {'object_name': 'Job'},
-            'data': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
-            'deployment_dir': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
-            'description': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'blank': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'is_shared': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
-            'is_trashed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
-            'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
-            'parameters': ('django.db.models.fields.TextField', [], {'default': '\'[{"name":"oozie.use.system.libpath","value":"true"}]\''}),
-            'schema_version': ('django.db.models.fields.CharField', [], {'max_length': '128'})
-        },
-        'oozie.join': {
-            'Meta': {'object_name': 'Join'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.kill': {
-            'Meta': {'object_name': 'Kill'},
-            'message': ('django.db.models.fields.CharField', [], {'default': "'Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]'", 'max_length': '256'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.link': {
-            'Meta': {'object_name': 'Link'},
-            'child': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'parent_node'", 'to': "orm['oozie.Node']"}),
-            'comment': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'child_node'", 'to': "orm['oozie.Node']"})
-        },
-        'oozie.mapreduce': {
-            'Meta': {'object_name': 'Mapreduce'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'jar_path': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"})
-        },
-        'oozie.node': {
-            'Meta': {'object_name': 'Node'},
-            'children': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'parents'", 'symmetrical': 'False', 'through': "orm['oozie.Link']", 'to': "orm['oozie.Node']"}),
-            'description': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '1024', 'blank': 'True'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'node_type': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
-            'workflow': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Workflow']"})
-        },
-        'oozie.pig': {
-            'Meta': {'object_name': 'Pig'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'script_path': ('django.db.models.fields.CharField', [], {'max_length': '256'})
-        },
-        'oozie.shell': {
-            'Meta': {'object_name': 'Shell'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'capture_output': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'command': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"})
-        },
-        'oozie.sqoop': {
-            'Meta': {'object_name': 'Sqoop'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'prepares': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'script_path': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'})
-        },
-        'oozie.ssh': {
-            'Meta': {'object_name': 'Ssh'},
-            'capture_output': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'command': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
-            'host': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'user': ('django.db.models.fields.CharField', [], {'max_length': '64'})
-        },
-        'oozie.start': {
-            'Meta': {'object_name': 'Start'},
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'})
-        },
-        'oozie.streaming': {
-            'Meta': {'object_name': 'Streaming'},
-            'archives': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'files': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'mapper': ('django.db.models.fields.CharField', [], {'max_length': '512'}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'reducer': ('django.db.models.fields.CharField', [], {'max_length': '512'})
-        },
-        'oozie.subworkflow': {
-            'Meta': {'object_name': 'SubWorkflow'},
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'node_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Node']", 'unique': 'True', 'primary_key': 'True'}),
-            'propagate_configuration': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
-            'sub_workflow': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['oozie.Workflow']"})
-        },
-        'oozie.workflow': {
-            'Meta': {'object_name': 'Workflow', '_ormbases': ['oozie.Job']},
-            'end': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'end_workflow'", 'null': 'True', 'to': "orm['oozie.End']"}),
-            'is_single': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'job_properties': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'job_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['oozie.Job']", 'unique': 'True', 'primary_key': 'True'}),
-            'job_xml': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '512', 'blank': 'True'}),
-            'managed': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
-            'start': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'start_workflow'", 'null': 'True', 'to': "orm['oozie.Start']"})
-        }
-    }
-
-    complete_apps = ['oozie']

+ 16 - 8
apps/oozie/src/oozie/models.py

@@ -219,6 +219,10 @@ class Job(models.Model):
     """Only owners or admins can modify a job."""
     return user.is_superuser or self.owner == user
 
+  @property
+  def data_dict(self):
+    return json.loads(self.data)
+
   @property
   def sla(self):
     if not self.data: # backward compatible
@@ -226,15 +230,16 @@ class Job(models.Model):
     return json.loads(self.data).get('sla', copy.deepcopy(DEFAULT_SLA))
 
   @property
-  def sla_jsescaped(self):
-    return json.dumps(self.sla, cls=JSONEncoderForHTML)
+  def data_js_escaped(self):
+    return json.dumps(self.data_dict, cls=JSONEncoderForHTML)
 
-  def set_sla(self, sla):
+  @sla.setter
+  def sla(self, sla):
     if not self.data: # backward compatible
       self.data = json.dumps({})    
     data_json = json.loads(self.data)
     data_json['sla'] = sla
-    self.data = json.dumps(data_json)
+    self.data = json.dumps(data_json) #data=json.dump({'sla': [python data], 'global': [python data], 'credentials': [python data]})
 
   @property
   def sla_enabled(self):
@@ -242,11 +247,13 @@ class Job(models.Model):
 
 
 class WorkflowManager(models.Manager):
-  SCHEMA_VERSION_V4 = 'uri:oozie:workflow:0.4'
-  SCHEMA_VERSION_V5 = 'uri:oozie:workflow:0.5'
+  SCHEMA_VERSION = {
+    '0.4': 'url:oozie:workflow:0.4',
+    '0.5': 'url:oozie:workflow:0.5'
+  }
 
   def new_workflow(self, owner):
-    workflow = Workflow(owner=owner, schema_version=WorkflowManager.SCHEMA_VERSION_V4)
+    workflow = Workflow(owner=owner, schema_version=WorkflowManager.SCHEMA_VERSION['0.4'])
 
     kill = Kill(name='kill', workflow=workflow, node_type=Kill.node_type)
     end = End(name='end', workflow=workflow, node_type=End.node_type)
@@ -755,7 +762,8 @@ class Node(models.Model):
   def sla(self):
     return json.loads(self.data).get('sla', copy.deepcopy(DEFAULT_SLA))
 
-  def set_sla(self, sla):
+  @sla.setter
+  def sla(self, sla):
     data_json = json.loads(self.data)
     data_json['sla'] = sla
     self.data = json.dumps(data_json)

+ 1 - 1
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -659,7 +659,7 @@ var workflow_model = new WorkflowModel({
   is_shared: "${ workflow.is_shared }" == "True",
   parameters: ${ workflow.parameters_escapejs | n,unicode },
   job_properties: ${ workflow.job_properties_escapejs | n,unicode },
-  sla: ${ workflow.sla_jsescaped | n,unicode }
+  data: ${ workflow.data_js_escaped | n,unicode }
 });
 var registry = new Registry();
 var workflow = new Workflow({

+ 1 - 1
apps/oozie/src/oozie/templates/utils.inc.mako

@@ -290,7 +290,7 @@
        'max-duration': {'niceName': '${ _("Max duration") }', 'placeHolder': '${"$"}{30 * MINUTES}'},
        'alert-events': {'niceName': '${ _("Alert events") }', 'placeHolder': 'start_miss,end_miss,duration_miss'},
        'alert-contact': {'niceName': '${ _("Alert contact") }', 'placeHolder': 'joe@example.com,bob@example.com'},
-       'notification-msg': {'niceName': '${ _("Notification message") }', 'placeHolder': 'My Job has encountered an SLA event!'},
+       'notification-msg': {'niceName': '${ _("Notification message") }', 'placeHolder': '${ _("My Job has encountered an SLA event!") }'},
        'upstream-apps': {'niceName': '${ _("Upstream apps") }', 'placeHolder': 'dependent-app-1, dependent-app-2'}
     }[key];
   };

+ 3 - 3
apps/oozie/src/oozie/tests.py

@@ -1274,7 +1274,7 @@ class TestEditor(OozieMockBase):
     sla[0]['value'] = True
     sla[1]['value'] = 'now' # nominal-time
     sla[3]['value'] = '${ 10 * MINUTES}' # should-end
-    self.wf.set_sla(sla)
+    self.wf.sla = sla
     self.wf.save()
 
     xml = self.wf.to_xml({'output': '/path'})
@@ -1315,7 +1315,7 @@ class TestEditor(OozieMockBase):
     sla[0]['value'] = True
     sla[1]['value'] = 'now' # nominal-time
     sla[3]['value'] = '${ 10 * MINUTES}' # should-end
-    action1.set_sla(sla)
+    action1.sla = sla
     action1.save()
 
     xml = self.wf.to_xml({'output': '/path'})
@@ -1463,7 +1463,7 @@ class TestEditor(OozieMockBase):
     sla[0]['value'] = True
     sla[1]['value'] = 'now' # nominal-time
     sla[3]['value'] = '${ 10 * MINUTES}' # should-end
-    coord.set_sla(sla)
+    coord.sla = sla
     coord.save()
 
     xml = coord.to_xml()

+ 4 - 4
apps/oozie/src/oozie/utils.py

@@ -62,10 +62,10 @@ def model_to_dict(model):
   for field in model._meta.fields:
     try:
       attr = getattr(model, field.name, None)
-      if field.name == 'data' and issubclass(type(model), Node):
-        if hasattr(model, 'sla'):
-          dictionary['sla'] = model.sla
-      elif isinstance(attr, models.Model):
+#      if field.name == 'data' and issubclass(type(model), Node):
+#        if hasattr(model, 'sla'):
+#          dictionary['sla'] = model.sla
+      if isinstance(attr, models.Model):
         dictionary[field.name] = attr.id
       elif isinstance(attr, datetime):
         dictionary[field.name] = str(attr)

+ 2 - 2
apps/oozie/src/oozie/views/api.py

@@ -206,7 +206,7 @@ def _update_workflow_nodes_json(workflow, json_nodes, id_map, user):
 
     for key in json_node:
       if key == 'sla':
-        node.set_sla(json_node[key])
+        node.sla = json_node[key]
       elif key not in ('node_ptr', 'child_nodes', 'workflow', 'id', 'sub_workflow'):
         setattr(node, key, format_field_value(key, json_node[key]))
 
@@ -231,7 +231,7 @@ def _update_workflow_json(json_workflow):
 
   for key in json_workflow:
     if key == 'sla':
-      workflow.set_sla(json_workflow['sla'])
+      workflow.sla = json_workflow['sla']
     elif key not in ('nodes', 'start', 'end', 'job_ptr', 'owner', 'data'):
       setattr(workflow, key, json_workflow[key])
 

+ 1 - 1
apps/oozie/src/oozie/views/editor.py

@@ -469,7 +469,7 @@ def edit_coordinator(request, coordinator):
       new_data_input_formset.save()
       new_data_output_formset.save()
       
-      coordinator.set_sla(json.loads(request.POST.get('sla')))
+      coordinator.sla = json.loads(request.POST.get('sla'))
       coordinator.save()
 
       request.info(_('Coordinator saved.'))

+ 7 - 6
apps/oozie/static/js/workflow.js

@@ -355,10 +355,10 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
     $.each(mapping['__ko_mapping__'].mappedProperties, function(key, value) {
       var key = key;
       if (self[key]) { //ugly? // allow custom sub bindings in foreach
-      self[key].subscribe(function(value) {
-        self.is_dirty(true);
-        self.model[key] = ko.mapping.toJS(value);
-      });
+        self[key].subscribe(function(value) {
+          self.is_dirty(true);
+          self.model[key] = ko.mapping.toJS(value);
+        });
       }
     });
 
@@ -396,7 +396,8 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
 
     module.prototype.initialize.apply(self, arguments);
 
-    self.sla = self.model['sla']; // Need to persists here for some reason
+    //self.sla = self.model['sla']; // Need to persists here for some reason
+    self.data = self.model['data']; // Need to persists here for some reason
 
     return self;
   };
@@ -535,7 +536,7 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
       });
       data['nodes'] = nodes;
       
-      data['sla'] = self.sla;
+      //data['sla'] = self.sla;
       
       return JSON.stringify(data);
     },

+ 16 - 16
apps/oozie/static/js/workflow.models.js

@@ -31,8 +31,8 @@ var DEFAULT_SLA = [
     {'key': 'upstream-apps', 'value': ''}
 ];
 
-function getDefaultSla() {
- return jQuery.extend(true, [], DEFAULT_SLA);
+function getDefaultData() {
+ return {'sla': jQuery.extend(true, [], DEFAULT_SLA)};
 }
 
 function normalize_model_fields(node_model) {
@@ -63,7 +63,7 @@ var map_params = function(options, subscribe) {
 
 // Maps JSON strings to fields in the view model.
 var MAPPING_OPTIONS = {
-  ignore: ['initialize', 'toString', 'copy', 'sla'], // Do not support cancel edit on SLA
+  ignore: ['initialize', 'toString', 'copy', 'data'], // Do not support cancel edit on data
   job_properties: {
     create: function(options) {
       var parent = options.parent;
@@ -354,7 +354,7 @@ $.extend(WorkflowModel.prototype, {
   is_shared: true,
   parameters: '[]',
   job_xml: '',
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var NodeModel = ModelModule($);
@@ -399,7 +399,7 @@ $.extend(DistCPModel.prototype, {
   job_xml: '',
   params: '[]',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var MapReduceModel = ModelModule($);
@@ -416,7 +416,7 @@ $.extend(MapReduceModel.prototype, {
   prepares: '[]',
   job_xml: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var StreamingModel = ModelModule($);
@@ -432,7 +432,7 @@ $.extend(StreamingModel.prototype, {
   mapper: '',
   reducer: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var JavaModel = ModelModule($);
@@ -453,7 +453,7 @@ $.extend(JavaModel.prototype, {
   java_opts: '',
   capture_output: false,
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var PigModel = ModelModule($);
@@ -471,7 +471,7 @@ $.extend(PigModel.prototype, {
   params: '[]',
   script_path: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var HiveModel = ModelModule($);
@@ -489,7 +489,7 @@ $.extend(HiveModel.prototype, {
   params: '[]',
   script_path: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var SqoopModel = ModelModule($);
@@ -507,7 +507,7 @@ $.extend(SqoopModel.prototype, {
   params: '[]',
   script_path: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var ShellModel = ModelModule($);
@@ -526,7 +526,7 @@ $.extend(ShellModel.prototype, {
   command: '',
   capture_output: false,
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var SshModel = ModelModule($);
@@ -542,7 +542,7 @@ $.extend(SshModel.prototype, {
   command: '',
   capture_output: false,
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var FsModel = ModelModule($);
@@ -558,7 +558,7 @@ $.extend(FsModel.prototype, {
   chmods: '[]',
   touchzs: '[]',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var EmailModel = ModelModule($);
@@ -573,7 +573,7 @@ $.extend(EmailModel.prototype, {
   subject: '',
   body: '',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var SubWorkflowModel = ModelModule($);
@@ -587,7 +587,7 @@ $.extend(SubWorkflowModel.prototype, {
   propagate_configuration: true,
   job_properties: '[]',
   child_links: [],
-  sla: getDefaultSla()
+  data: getDefaultData()
 });
 
 var GenericModel = ModelModule($);