Skip to content

Commit

Permalink
[BUG FIX]: removing property in state machine data access
Browse files Browse the repository at this point in the history
  • Loading branch information
gokulvasan committed May 3, 2016
1 parent 0f73884 commit c417dd2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
10 changes: 5 additions & 5 deletions ss_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def dequeue(self, data):
else:
print "data is not in list"
return 0
@property

def data(self):
pass

class guaranteed_list(sslist):
def __init__(self):
super(guaranteed_list, self).__init__()
@property

def data(self):
if self.q:
job = min(self.q,
Expand All @@ -30,7 +30,7 @@ def data(self):
class not_guaranteed_list(sslist):
def __init__(self):
super(not_guaranteed_list, self).__init__()
@property

def data(self):
if self.q:
job = self.q.pop(0)
Expand All @@ -40,7 +40,7 @@ def data(self):
class unconcluded_list(sslist):
def __init__(self):
super(unconcluded_list, self).__init__()
@property

def data(self):
if self.q:
# ERROR: here it should dequeue
Expand All @@ -57,7 +57,7 @@ def queue(self, data):
return -1
self.curr_job = data
return 0
@property

def data(self):
return self.curr_job

Expand Down
18 changes: 10 additions & 8 deletions ss_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __check_transition(self, curr_state, nxt_state):
def __change_state(self, job, nxt_state):
ret = -1
tsk_data = job.task.data
#print "CURR STATE{} NXT STATE {}".format(tsk_data.curr_state, nxt_state)
print "CURR STATE{} NXT STATE {}".format(tsk_data.curr_state, nxt_state)
if self.__check_transition(tsk_data.curr_state, nxt_state):
if tsk_data.curr_state >= 0:
if self.__st[tsk_data.curr_state].exit(job) < 0:
Expand All @@ -126,7 +126,7 @@ def __change_state(self, job, nxt_state):
def rmv_job(self, job):
data = job.data
data.curr_state = tsk_state.exit.value
curr_job = self.__st[tsk_state.running.value].queue.data
curr_job = self.__st[tsk_state.running.value].queue.data()
if curr_job == job:
#print " removing current job"
self.__st[tsk_state.running.value].exit(job)
Expand Down Expand Up @@ -154,7 +154,7 @@ def transit_unconcluded_tsk(self, transition):
4. return count on success
"""
queue = self.__st[tsk_state.unconcluded.value].queue
job = queue.data
job = queue.data()
if job:
tsk = job.task
state = transition(tsk)
Expand All @@ -168,9 +168,9 @@ def selection_function(self):
3. if not check on !guarantee
4. move the tsk to curr_tsk state.
"""
prev_job = self.__st[tsk_state.running.value].queue.data
prev_job = self.__st[tsk_state.running.value].queue.data()
if prev_job:
#print "prev job {}".format(prev_job.name)
print "prev job {}->{}".format(prev_job.name, prev_job.computation_time)
prev_tsk_type = prev_job.task.data.tsk_type
if (tsk_type.periodic.value == prev_tsk_type or
tsk_type.firm_aperiodic_g.value == prev_tsk_type):
Expand All @@ -181,13 +181,15 @@ def selection_function(self):
tsk_state.not_guarantee.value)
else:
return -1
else :
print "PREV JOB IS NONE"

job = self.__st[tsk_state.guarantee.value].queue.data
job = self.__st[tsk_state.guarantee.value].queue.data()
if None == job:
job = self.__st[tsk_state.not_guarantee.value].queue.data
job = self.__st[tsk_state.not_guarantee.value].queue.data()
if None != job:
self.__change_state(job, tsk_state.running.value)
#print " Selected job {}".format(job.name)
print " Selected job {}".format(job.name)
return job

"""
Expand Down

0 comments on commit c417dd2

Please sign in to comment.