From: Maciej Tronowski Date: Tue, 28 Apr 2015 10:54:14 +0000 (+0200) Subject: handling master file for application type jobs X-Git-Tag: v1.0~31 X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=dc56e8385ff789891593b39b15a840e3ffdf4e24;p=qcg-portal.git handling master file for application type jobs --- diff --git a/qcg/forms.py b/qcg/forms.py index 35b34d7..4cd49e7 100644 --- a/qcg/forms.py +++ b/qcg/forms.py @@ -117,7 +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 + 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) # TODO saving to grid ftp arguments = forms.MultipleChoiceField(label=u"Argumenty", required=False) @@ -174,6 +174,9 @@ class JobDescriptionForm(forms.Form): def clean(self): data = super(JobDescriptionForm, self).clean() + if data['application'] and not data['master_file']: + self.add_error('master_file', u"W trybie uruchamiania aplikacji należy podać plik główny") + notify_type = data.get('notify_type') data['notify'] = u'{}:{}'.format(notify_type, data['notify_address']) if notify_type else '' @@ -204,6 +207,9 @@ class JobDescriptionForm(forms.Form): def clean_executable(self): return self._gsiftp_suffix(self.cleaned_data['executable']) + def clean_master_file(self): + return self._gsiftp_suffix(self.cleaned_data['master_file']) + def clean_nodes(self): return map(int, self.cleaned_data['nodes'].split(':', 2)) if self.cleaned_data['nodes'] else '' diff --git a/qcg/service.py b/qcg/service.py index be0ccac..44cb42e 100644 --- a/qcg/service.py +++ b/qcg/service.py @@ -1,4 +1,5 @@ import logging +import os import time from django.db import transaction @@ -147,6 +148,8 @@ def submit_job(params, proxy): if params['application']: desc.set_application(*params['application']) + desc.stage_in += [params['master_file']] + desc.arguments.insert(0, os.path.basename(params['master_file'])) if params['nodes']: desc.set_nodes(*params['nodes']) if params['reservation']: