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
ecd02eab
Commit
ecd02eab
authored
Feb 16, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to add decomposition/reassembly between stations added
parent
05d5d6c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
0 deletions
+101
-0
dream/plugins/AddBatchStations.py
dream/plugins/AddBatchStations.py
+101
-0
No files found.
dream/plugins/AddBatchStations.py
0 → 100644
View file @
ecd02eab
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
class
AddBatchStations
(
plugin
.
InputPreparationPlugin
):
""" Input preparation
checks if the Batch Station processes Batchs or SubBatches and in the former case adds a decomposition/reassembly
to set to the working batch
"""
def
preprocess
(
self
,
data
):
nodes
=
copy
(
data
[
'graph'
][
'node'
])
edges
=
copy
(
data
[
'graph'
][
'edge'
])
data_uri_encoded_input_data
=
data
[
'input'
].
get
(
self
.
configuration_dict
[
'input_id'
],
{})
for
node_id
,
node
in
nodes
.
iteritems
():
if
node
[
'_class'
]
==
'Dream.BatchScrapMachine'
and
self
.
checkIfMachineProcessesBatches
(
node_id
):
#create a batchDecomposition
batchDecompositionId
=
node_id
+
'_D'
data
[
'graph'
][
'node'
][
batchDecompositionId
]
=
{
"name"
:
batchDecompositionId
,
"processingTime"
:
{
"Fixed"
:
{
"mean"
:
0
}
},
"numberOfSubBatches"
:
8
,
"wip"
:
[],
"element_id"
:
"DreamNode_39"
,
"_class"
:
"Dream.BatchDecompositionBlocking"
,
"id"
:
batchDecompositionId
}
#put the batchDecomposition between the predecessor and the node
for
edge_id
,
edge
in
edges
.
iteritems
():
if
edge
[
'destination'
]
==
node_id
:
source
=
edge
[
'source'
]
# remove the edge
data
[
'graph'
][
'edge'
].
pop
(
edge_id
,
None
)
# add an edge from source to batchDecomposition
data
[
'graph'
][
'edge'
][
source
+
'_to_'
+
batchDecompositionId
]
=
{
"source"
:
source
,
"destination"
:
batchDecompositionId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# add an edge from batchDecomposition machine
data
[
'graph'
][
'edge'
][
batchDecompositionId
+
'_to_'
+
node_id
]
=
{
"source"
:
batchDecompositionId
,
"destination"
:
node_id
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
#create a batchReassembly
batchReassemblyId
=
node_id
+
'_R'
data
[
'graph'
][
'node'
][
batchReassemblyId
]
=
{
"name"
:
batchReassemblyId
,
"processingTime"
:
{
"Fixed"
:
{
"mean"
:
0
}
},
"outputResults"
:
1
,
"numberOfSubBatches"
:
8
,
"wip"
:
[],
"_class"
:
"Dream.BatchReassemblyBlocking"
,
"id"
:
batchReassemblyId
}
#put the batchReassembly between the node and the successor
for
edge_id
,
edge
in
edges
.
iteritems
():
if
edge
[
'source'
]
==
node_id
:
destination
=
edge
[
'destination'
]
# remove the edge
data
[
'graph'
][
'edge'
].
pop
(
edge_id
,
None
)
# add an edge from node to destination
data
[
'graph'
][
'edge'
][
node_id
+
'_to_'
+
batchReassemblyId
]
=
{
"source"
:
node_id
,
"destination"
:
batchReassemblyId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# add an edge from batchDecomposition machine
data
[
'graph'
][
'edge'
][
batchReassemblyId
+
'_to_'
+
destination
]
=
{
"source"
:
batchReassemblyId
,
"destination"
:
destination
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# dataString=json.dumps(data['graph']['edge'], indent=5)
# print dataString
return
data
# returns true is a machine processes full batches
def
checkIfMachineProcessesBatches
(
self
,
machinId_id
):
# dummy implementation for now
return
True
\ No newline at end of file
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