fixes for updated api
authorMaciej Tronowski <mtro@man.poznan.pl>
Wed, 4 Mar 2015 16:34:34 +0000 (17:34 +0100)
committerMaciej Tronowski <mtro@man.poznan.pl>
Wed, 4 Mar 2015 16:34:34 +0000 (17:34 +0100)
qcg/forms.py
qcg/templates/qcg/job_new.html
qcg/views.py

index 7d53c7c..a3524d5 100644 (file)
@@ -116,7 +116,7 @@ class JobDescriptionForm(forms.Form):
     note = forms.CharField(label=u"Opis", widget=forms.Textarea(attrs={'rows': 2, 'cols': 40}), required=False)
     grant = forms.CharField(label=u"Grant", max_length=100, required=False)
 
-    host = forms.ChoiceField(label=u"Host", choices=Host.CHOICES, required=False)
+    host = forms.MultipleChoiceField(label=u"Host", choices=Host.CHOICES, required=False)
     properties = forms.MultipleChoiceField(label=u"Właściwości węzłów", required=False)
     queue = forms.ChoiceField(choices=QUEUE_CHOICES, label=u"Kolejka", required=False)
     procs = forms.IntegerField(label=u"Liczba procesów", min_value=0, required=False)
index f2f55c2..7929749 100644 (file)
@@ -3,19 +3,15 @@
 
 {% block extra_css %}
     <link href="{% static 'qcg/selectize/selectize.bootstrap3.css' %}" rel="stylesheet">
-    <link href="{% static 'qcg/datetimepicker/bootstrap-datetimepicker.min.css' %}" rel="stylesheet">
 {% endblock %}
 
 {% block extra_js %}
     <script src="{% static 'qcg/selectize/selectize.min.js' %}"></script>
     <script src="{% static 'qcg/formset/jquery.formset.js' %}"></script>
-    <script src="{% static 'qcg/moment/moment.min.js' %}"></script>
-    <script src="{% static 'qcg/moment/pl.js' %}"></script>
-    <script src="{% static 'qcg/datetimepicker/bootstrap-datetimepicker.min.js' %}"></script>
 
     <script>
         $(function() {
-            $('#id_application, #id_host').selectize();
+            $('#id_application').selectize();
             $('#id_arguments,#id_properties,#id_native').selectize({
                 plugins: ['remove_button'],
                 create: true,
@@ -33,7 +29,7 @@
                     }
                 }
             });
-            $('#id_modules').selectize({
+            $('#id_modules, #id_host').selectize({
                 plugins: ['remove_button']
             });
 
                 deleteCssClass: 'delete-btn btn btn-xs btn-danger'
             });
 
-            $('#id_not_before,#id_not_after').datetimepicker({
-                locale: 'pl',
-                minDate: moment()
-            });
-
             $('input[name="notify_type"],input[name="watch_output_type"],input[name="preprocess_type"],input[name="postprocess_type"]').on('change', function () {
                 $(this).tab('show');
             }).each(function() {
index c34af9b..aaa0bdc 100644 (file)
@@ -165,26 +165,26 @@ def job_new(request):
 
             application = form.cleaned_data['application']
             if '/' in application:
-                app, ver = application.split('1', 1)
-                desc.application.set_name(app)
-                desc.application.set_version(ver)
+                app_tuple = application.split('/', 1)
             else:
-                desc.application.set_name(application)
+                app_tuple = (application, None)
+            desc.application = app_tuple
 
             # TODO script
             # TODO executable
             desc.arguments = form.cleaned_data['arguments']
             desc.note = form.cleaned_data['note']
             desc.grant = form.cleaned_data['grant']
-            desc.host_candidates = [(form.cleaned_data['host'], 'type?')]  # FIXME WTF ?!?
+            desc.hosts = form.cleaned_data['host']
             desc.properties = form.cleaned_data['properties']
             # TODO queue
             # TODO procs
             # TODO nodes
-            desc.wall_time = timedelta(seconds=form.cleaned_data['wall_time'])  # FIXME odpowiedni typ pola
+            if form.cleaned_data['wall_time'] is not None:
+                desc.wall_time = form.cleaned_data['wall_time']
             desc.memory = form.cleaned_data['memory']
             desc.memory_per_slot = form.cleaned_data['memory_per_slot']
-            desc.variable = [(env['name'], env['value']) for env in env_formset.cleaned_data if not env['DELETE']]
+            desc.env_variables = [(env['name'], env['value']) for env in env_formset.cleaned_data if not env['DELETE']]
             desc.modules = form.cleaned_data['modules']
             desc.natives = form.cleaned_data['native']
             desc.reservation = ("LOCAL", form.cleaned_data['reservation'])
@@ -205,8 +205,8 @@ def job_new(request):
             # TODO postprocess_script
             desc.persistent = form.cleaned_data['persistent']
 
-            for prop in ('arguments', 'note', 'grant', 'host_candidates', 'wall_time', 'memory',
-                         'memory_per_slot', 'properties', 'variable', 'modules', 'natives', 'persistent', 'reservation'):
+            for prop in ('application', 'arguments', 'note', 'grant', 'hosts', 'wall_time', 'memory', 'memory_per_slot',
+                         'properties', 'env_variables', 'modules', 'natives', 'persistent', 'reservation'):
                 print prop, type(getattr(desc, prop)), repr(getattr(desc, prop))
 
             print desc.xml_description