forked from cslab-ntua/vRJMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
job.py
30 lines (23 loc) · 886 Bytes
/
job.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
import aux
class Job:
def __init__(self, id, app, procs, duration, enter, exclusive, start = None, interval = None):
self.id = id
self.app = app
self.procs = procs
self.duration = duration
self.enter = enter
self.exclusive = exclusive
self.start = start
self.interval = interval
def startedat(self, timestamp):
self.start = timestamp
def runafter(self, interval):
self.interval = interval
def remaining(self):
return round(self.duration-aux.elapsed(self.start))
def state(self):
return 'R' if self.start else 'Q'
def __str__(self):
return str(self.id) + ' ' + ' ' + self.app + ' ' + ' ' + str(self.procs) + ' ' + ' ' + self.state() + ' ' + ' ' + aux.tostring(self.start) + ' ' + ' ' + str(self.duration)