source: geniuswebcore/geniusweb/deadline/DeadlineTime.py@ 69

Last change on this file since 69 was 67, checked in by Bart Vastenhouw, 3 years ago

Added SAOP and simplerunner to GeniusWebPython. Several minor fixes.

File size: 837 bytes
RevLine 
[67]1from pyson.JsonGetter import JsonGetter
2
3from geniusweb.deadline.Deadline import Deadline
4
5
6class DeadlineTime ( Deadline):
7 '''
8 How long a session will be allowed to run
9 '''
10
11 def __init__(self, durationms:int ):
12 '''
13 @param durationms number of milliseconds the session will be allowed to run
14 '''
15 if durationms <= 0:
16 raise ValueError("deadline must be positive time");
17 self._durationms = durationms
18
19 @JsonGetter("durationms")
20 def getDuration(self) -> int:
21 '''
22 @return the duration of this deadline, measured in milliseconds
23 '''
24 return self._durationms;
25
26 def __repr__(self) -> str:
27 return "DeadlineTime[" + str(self._durationms) + "]";
28
29
30 def __hash__(self):
31 return hash(self._durationms)
32
33 def __eq__(self, other):
34 return isinstance(other, self.__class__) \
35 and self._durationms == other._durationms
36
Note: See TracBrowser for help on using the repository browser.