Basic ultrastorage: simulation

Reproducibility


In [1]:
import IPython
IPython.__version__


Out[1]:
'3.0.0'

In [2]:
import matplotlib
matplotlib.__version__


Out[2]:
'1.4.3'

In [3]:
import numpy as np
np.__version__


Out[3]:
'1.9.2'

In [4]:
import simpy
simpy.__version__


Out[4]:
'3.0.5'

In [5]:
import ultrastorage
ultrastorage.__version__


Out[5]:
'0.0.1'

Imports


In [10]:
# non-reconfigurable simulator
import ultrastorage.simulator.nonreconfigurable as nonreconfigurable

# insertion politics
import ultrastorage.inserter as inserter

# storage system
import ultrastorage.storagesystem as storagesystem

# item generator
import ultrastorage.itemgenerator as itemgenerator

# timout generator
import ultrastorage.timeoutgenerator as timeoutgenerator

# timed item generator
import ultrastorage.timeditemgenerator as timeditemgenerator

# tools
import ultrastorage.tool as tool

Storage system


In [11]:
name                    = "myStorageSystem"
number_of_storage_units = 3
capacity                = tool.unit.terabyte(1)
cpu                     = 2
storage_system = storagesystem.homogeneous_storage_system_builder(number_of_storage_units, capacity, cpu, name=name)
print(storage_system)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-612e637a8ebb> in <module>()
      1 name                    = "myStorageSystem"
      2 number_of_storage_units = 3
----> 3 capacity                = tool.unit.terabyte(1)
      4 cpu                     = 2
      5 storage_system = storagesystem.homogeneous_storage_system_builder(number_of_storage_units, capacity, cpu, name=name)

AttributeError: 'module' object has no attribute 'unit'

Simulator


In [ ]:
simulator = nonreconfigurable.Overflow(storage_system, inserter.FirstFit)

In [ ]:
# 
item_generator = itemgenerator.VU2005()

# 
timeout_generator = timeoutgenerator.Exponential()

# combine the item generator and the timeout generator
timed_item_generator = timeditemgenerator.TimedItemGenerator(item_generator, timeout_generator)

# let simpy know about this timed item generator
environment.process(timed_item_generator.run(simulator))

Simulation


In [ ]:
simulator.run()

In [ ]:
for item_event in storage_system.item_event_controller:
    print(item_event)

In [ ]:
#snapshots = storage_system.snapshot_controller.snapshots()
for (index, snapshot) in enumerate(storage_system.snapshot_controller):
	print("{}: {}\n".format(index+1, str(snapshot)))

Analysis


In [ ]:
snapshot_reporter = storagesystem.StorageSystemSnapshotReporter(storage_system.snapshot_controller)

In [ ]:
for i, sizes in enumerate(snapshot_reporter.values('size')):
	print("{}: {}".format(i+1, sizes))

In [ ]:
for i, size in enumerate(snapshot_reporter.average('size')):
	print("{}: {}".format(i+1, size))

In [ ]: