wlaczony debuging
authorDawid Jagieła <lightnir@gmail.com>
Sun, 6 Sep 2015 20:55:45 +0000 (22:55 +0200)
committerDawid Jagieła <lightnir@gmail.com>
Sun, 6 Sep 2015 20:55:45 +0000 (22:55 +0200)
qcg/forms.py
qcg/templates/qcg/job_submit.html
qcg/templates/qcg/job_submit_form.html
qcg/views.py

index 2708c5e..491ad30 100644 (file)
@@ -91,7 +91,8 @@ class JobDescriptionForm(forms.Form):
 
     APPLICATION_CHOICES = (
         CHOICES_PLACEHOLDER,
-        ('unres32', 'UNRES 3.2'),
+        ('unres-gab', 'UNRES GAB'),
+        ('unres-e0ll2y', 'UNRES E0LL2Y'),
     )
         
     QUEUE_CHOICES = (
@@ -101,8 +102,7 @@ class JobDescriptionForm(forms.Form):
         ('plgrid-testing', 'plgrid-testing'),
     )
     MODULES_CHOICES = (
-        ('plgrid/apps/python', 'plgrid/apps/python'),
-        ('plgrid/apps/matlab', 'plgrid/apps/matlab'),
+        CHOICES_PLACEHOLDER,
     )
     PROTOCOL_CHOICES = (
         ('', u'Brak'),
@@ -127,7 +127,7 @@ class JobDescriptionForm(forms.Form):
     retmin = forms.IntegerField(label=u"RETMIN", help_text=u"Dolny zakres temparatur dla wymiany replik", min_value=2, initial=250, required=False)
     retmax = forms.IntegerField(label=u"RETMAX", help_text=u"Górny zakres temperatur dla wymiany replik", min_value=2, initial=450, required=False)
     
-    application = forms.ChoiceField(choices=APPLICATION_CHOICES, label=u"Aplikacja", required=False, initial='unres32')  # TODO choices
+    application = forms.ChoiceField(choices=APPLICATION_CHOICES, label=u"Aplikacja", required=False, initial='unres-gab')  # TODO choices
     master_file = forms.CharField(label=u"Plik główny", max_length=500, required=False)
     executable = forms.CharField(label=u"Plik wykonywalny", max_length=500, required=False)
     script = forms.CharField(label=u"Skrypt", widget=forms.Textarea(attrs={'rows': 2, 'cols': 40}), required=False)
@@ -182,14 +182,15 @@ class JobDescriptionForm(forms.Form):
         data = super(JobDescriptionForm, self).clean()
             
         force_field = data.get('force_field')
-        if force_field == self.FORCE_FIELD_CHOICES[0]:
+        
+        if force_field == u'GAB':
             data['application'] = [u'unres-gab']
         else:
             data['application'] = [u'unres-e0ll2y']
 
-        if data['master_file']:
-            self.add_error('master_file', u"Należy podać plik główny")
-
+        '''if data['master_file']:
+            self.add_error('master_file', u"Należy podać plik główny. :"+data['master_file'])
+        '''
         if data['procs'] and data['nodes']:
             self.add_error(None, u"Zdefiniuj tylko jedno z pól: liczbę procesów lub topologię węzłów")
 
index 0afb982..6a712a9 100644 (file)
@@ -97,7 +97,6 @@
             });
 
             $('#id_modules,#id_hosts,#id_pdb_file,#id_master_file,#id_executable,#id_input,#id_stage_in,#id_preprocess_script,#id_postprocess_script').selectize({
-
                 plugins: ['remove_button']
             });
 
index ffbf92f..69ad5c8 100644 (file)
 
         {% bootstrap_field form.retmin layout="horizontal" form_group_class="form-group collapse" %}
         {% bootstrap_field form.retmax layout="horizontal" form_group_class="form-group collapse" %}
-        
-        {% bootstrap_field form.application layout="horizontal" %}
-
         {% bootstrap_field form.master_file layout="horizontal" %}
-        <!-- {% bootstrap_field form.application layout="horizontal" %}
+                
+        {% bootstrap_field form.application layout="horizontal" %}
         {% bootstrap_field form.executable layout="horizontal" form_group_class="form-group collapse" %}
         {% bootstrap_field form.script layout="horizontal" form_group_class="form-group collapse" %}
         {% bootstrap_field form.arguments layout="horizontal" %}
         {% bootstrap_field form.note layout="horizontal" %}
-        {% bootstrap_field form.grant layout="horizontal" form_group_class="form-group collapse" %}
+        {% bootstrap_field form.grant layout="horizontal" form_group_class="form-group collapse" %} 
     </fieldset>
 
     <fieldset id="resources" class="tab-pane" role="tabpanel">
index e5ff70f..dfeebd3 100644 (file)
@@ -26,6 +26,8 @@ from qcg.models import JobTemplate
 from qcg.utils import paginator_context, to_job_desc, to_form_data
 from qcg.service import update_user_data, update_job, cancel, clean
 
+# for Debugging
+from pprint import pprint
 
 def index(request):
     return render(request, 'qcg/base.html')
@@ -207,6 +209,12 @@ def job_submit(request, template_id=None):
             params['env_variables'] = [(env['name'], env['value'])
                                        for env in env_formset.cleaned_data if env and not env['DELETE']]
 
+            # tu wygenerować plik inputowy i go uploadować?
+
+            params['persistent'] = True
+            # Debugging parametrów
+            pprint(params)
+
             job_desc = to_job_desc(params, request.session['proxy'])
 
             if save_template:
@@ -218,12 +226,14 @@ def job_submit(request, template_id=None):
 
                 return redirect(template)
 
+            # wyłączenie wysyłania zadania
+            '''
             job = job_desc.submit()
 
             messages.success(request,
                              format_html('<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> '
                                          u'Zlecono zadanie <em>{}</em>.', job.job_id))
-
+            '''
             return redirect('jobs')
     else:
         form = JobDescriptionForm(initial=form_data)