Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
8867334d
Commit
8867334d
authored
Sep 27, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
on initialize of Jobs, currentStation check and remainingRoute update
parent
15851e75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
dream/simulation/Job.py
dream/simulation/Job.py
+24
-14
No files found.
dream/simulation/Job.py
View file @
8867334d
...
...
@@ -105,20 +105,30 @@ class Job(Entity): # inherits from the Entity c
# initializes all the Entity for a new simulation replication
# =======================================================================
def
initialize
(
self
):
# has to be re-initialized each time a new Job is added
self
.
remainingRoute
=
list
(
self
.
route
)
# check the number of stations in the stationIdsList for the current step (0)
# if it is greater than 1 then there is a problem definition
objectIds
=
self
.
route
[
0
].
get
(
'stationIdsList'
,[])
try
:
if
len
(
objectIds
)
==
1
:
from
Globals
import
findObjectById
self
.
currentStation
=
findObjectById
(
objectIds
[
0
])
else
:
from
Globals
import
SetWipTypeError
raise
SetWipTypeError
(
'The starting station of the the entity is not defined uniquely'
)
except
SetWipTypeError
as
setWipError
:
print
'WIP definition error: {0}'
.
format
(
setWipError
)
if
self
.
currentStation
:
for
step
in
self
.
route
:
stepObjectIds
=
step
.
get
(
'stationIdsList'
,[])
if
self
.
currentStation
.
id
in
stepObjectIds
:
ind
=
self
.
route
.
index
(
step
)
self
.
remainingRoute
=
self
.
route
[
ind
:]
break
else
:
# has to be re-initialized each time a new Job is added
self
.
remainingRoute
=
list
(
self
.
route
)
# check the number of stations in the stationIdsList for the current step (0)
# if it is greater than 1 then there is a problem definition
objectIds
=
self
.
route
[
0
].
get
(
'stationIdsList'
,[])
try
:
if
len
(
objectIds
)
==
1
:
from
Globals
import
findObjectById
self
.
currentStation
=
findObjectById
(
objectIds
[
0
])
else
:
from
Globals
import
SetWipTypeError
raise
SetWipTypeError
(
'The starting station of the the entity is not defined uniquely'
)
except
SetWipTypeError
as
setWipError
:
print
'WIP definition error: {0}'
.
format
(
setWipError
)
#===========================================================================
# check if the requireParts of the entity next step sequence (route) have
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment