X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;ds=sidebyside;f=qcg%2Fforms.py;h=7d53c7c6c30f346db1e4f821b877bdea5555079f;hb=903e20bd4bc9c523074479875ccb16b221091dda;hp=3109419cbdbfe085387e8da3f71152c6282ef083;hpb=4a6594602329d9b7689ca9d1fc82778d7c18b0be;p=qcg-portal.git diff --git a/qcg/forms.py b/qcg/forms.py index 3109419..7d53c7c 100644 --- a/qcg/forms.py +++ b/qcg/forms.py @@ -4,7 +4,7 @@ from django.core.validators import RegexValidator from django.template.defaultfilters import capfirst from pyqcg.utils import TaskStatus -from qcg.fields import PredefinedChoiceField, MultiplePredefinedChoiceField +from qcg.fields import TimeRangeField from qcg.models import Task, Allocation @@ -84,8 +84,9 @@ class JobDescriptionForm(forms.Form): APPLICATION_CHOICES = ( CHOICES_PLACEHOLDER, ('bash', 'BASH'), - ('python', 'Python'), + ('gromacs/4.6.3', 'GROMACS 4.6.3'), ('matlab', 'MATLAB'), + ('python', 'Python'), ) QUEUE_CHOICES = ( CHOICES_PLACEHOLDER, @@ -109,36 +110,28 @@ class JobDescriptionForm(forms.Form): ) application = forms.ChoiceField(choices=APPLICATION_CHOICES, label=u"Aplikacja", required=False) # TODO choices - executable = forms.CharField(label=u"Polecenie", max_length=500, required=False) # TODO grid ftp - arguments = forms.CharField(label=u"Argumenty", max_length=1000, required=False) - - name = forms.CharField(label=u"Nazwa", max_length=100, required=False) - note = forms.CharField(label=u"Notatka", widget=forms.Textarea(attrs={'rows': 2, 'cols': 40}), required=False) + 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) + 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) - queue = PredefinedChoiceField(choices=QUEUE_CHOICES, label=u"Kolejka", 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) nodes = forms.CharField(label=u"Topologia węzłów", max_length=10, validators=[nodes_validator], required=False) - wall_time = forms.IntegerField(label=u"Wall time (s)", min_value=0, required=False) # TODO duration field + wall_time = TimeRangeField(label=u"Wall time", required=False) memory = forms.IntegerField(label=u"Pamięć (MB)", min_value=0, required=False) memory_per_slot = forms.IntegerField(label=u"Pamięci per proces (MB)", min_value=0, required=False) + modules = forms.MultipleChoiceField(label=u"Moduły", choices=MODULES_CHOICES, required=False) # TODO choices + 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) - output = forms.CharField(label=u"Standardowe wyjście", max_length=500, required=False) - error = forms.CharField(label=u"Standardowe wyjście błędów", 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) - properties = MultiplePredefinedChoiceField(label=u"Właściwości węzłów", required=False) - modules = forms.MultipleChoiceField(label=u"Moduły", choices=MODULES_CHOICES, required=False) # TODO choices - - not_after = forms.DateTimeField(label=u"Nie później niż", required=False) - not_before = forms.DateTimeField(label=u"Nie wcześniej niż", required=False) - deadline = forms.IntegerField(label=u"Deadline (s)", min_value=0, required=False) # TODO duration field - reservation = forms.CharField(label=u"Rezerwacja", max_length=100, required=False) - monitoring = forms.BooleanField(label=u"Portal QCG-Monitoring", required=False) notify_type = forms.ChoiceField(label=u"Monitorowanie stanu", choices=NOTIFY_CHOICES, required=False, initial=0, widget=forms.RadioSelect) @@ -156,9 +149,18 @@ class JobDescriptionForm(forms.Form): widget=forms.RadioSelect) postprocess_cmd = forms.CharField(label=u"Polecenie", max_length=1000, required=False) postprocess_script = forms.CharField(label=u"Skrypt", max_length=500, required=False) # TODO grid ftp - native = MultiplePredefinedChoiceField(label=u"Parametry natywne", required=False) + native = forms.MultipleChoiceField(label=u"Opcje systemu kolejkowego", required=False) persistent = forms.BooleanField(label=u"Trwałe", required=False) - use_scratch = forms.BooleanField(label=u"Scratch", required=False) + + def __init__(self, data=None, *args, **kwargs): + super(JobDescriptionForm, self).__init__(data, *args, **kwargs) + + if data is not None: + # accept user defined choices + self.fields['queue'].choices += ((data.get('queue'), data.get('queue')), ) + 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')) class EnvForm(forms.Form):