enhancements in selecting file from gridftp & moved submitting jobs to separate file
[qcg-portal.git] / qcg / forms.py
index f66ada6..74eec37 100644 (file)
@@ -117,6 +117,7 @@ class JobDescriptionForm(forms.Form):
     )
 
     application = forms.ChoiceField(choices=APPLICATION_CHOICES, label=u"Aplikacja", required=False)  # TODO choices
+    master_file = forms.CharField(label=u"Plik główny", max_length=500, required=False)  # TODO grid ftp
     executable = forms.CharField(label=u"Plik wykonywalny", max_length=500, required=False)  # TODO grid ftp
     script = forms.CharField(label=u"Skrypt", widget=forms.Textarea(attrs={'rows': 2, 'cols': 40}), required=False)  # TODO saving to grid ftp
     arguments = forms.MultipleChoiceField(label=u"Argumenty", required=False)
@@ -135,9 +136,9 @@ class JobDescriptionForm(forms.Form):
     reservation = forms.CharField(label=u"Rezerwacja", max_length=100, required=False)
 
     # TODO grid ftp
-    input = forms.CharField(label=u"Standardowe wejście", max_length=500, required=False)
-    stage_in = forms.CharField(label=u"Stage in", max_length=500, required=False)
-    stage_out = forms.CharField(label=u"Stage out", max_length=500, required=False)
+    input = forms.MultipleChoiceField(label=u"Standardowe wejście", required=False)
+    stage_in = forms.MultipleChoiceField(label=u"Stage in", required=False)
+    # stage_out = forms.MultipleChoiceField(label=u"Stage out", required=False)
 
     monitoring = forms.BooleanField(label=u"Portal QCG-Monitoring", required=False)
     notify_type = forms.ChoiceField(label=u"Monitorowanie stanu", choices=PROTOCOL_CHOICES, required=False, initial='',
@@ -168,6 +169,9 @@ class JobDescriptionForm(forms.Form):
             self.fields['arguments'].choices += ((v, v) for v in data.getlist('arguments'))
             self.fields['properties'].choices += ((v, v) for v in data.getlist('properties'))
             self.fields['native'].choices += ((v, v) for v in data.getlist('native'))
+            self.fields['input'].choices += ((v, v) for v in data.getlist('input'))
+            self.fields['stage_in'].choices += ((v, v) for v in data.getlist('stage_in'))
+            # self.fields['stage_out'].choices += ((v, v) for v in data.getlist('stage_out'))
 
     def clean(self):
         data = super(JobDescriptionForm, self).clean()
@@ -195,10 +199,13 @@ class JobDescriptionForm(forms.Form):
             data['postprocess'] = ''
 
     def clean_application(self):
-        return self.cleaned_data['application'].split('/', 1)
+        return self.cleaned_data['application'].split('/', 1) if self.cleaned_data['application'] else ''
+
+    def clean_executable(self):
+        return 'gsiftp://' + self.cleaned_data['executable'] if self.cleaned_data['executable'] else ''
 
     def clean_nodes(self):
-        return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else None
+        return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else ''
 
 
 class EnvForm(forms.Form):