GoogleTaskEventsTraceReader¶
-
public final class
GoogleTaskEventsTraceReader
extends GoogleTraceReaderAbstract<Cloudlet>¶ Process “task events” trace files from Google Cluster Data to create
Cloudlet
s belonging to cloud customers (users). Customers are represented asDatacenterBroker
instances created from the trace file. The trace files are the ones inside the task_events sub-directory of downloaded Google traces. The instructions to download the traces are provided in the link above.The class also creates the required brokers to represent the customers (users) defined by the username field inside the trace file.
A spreadsheet that makes it easier to understand the structure of trace files is provided in docs/google-cluster-data-samples.xlsx
The documentation for fields and values were obtained from the Google Cluster trace documentation in the link above. It’s strongly recommended to read such a documentation before trying to use this class.
Author: Manoel Campos da Silva Filho See also:
.process()
Constructors¶
GoogleTaskEventsTraceReader¶
-
public
GoogleTaskEventsTraceReader
(CloudSim simulation, String filePath, Function<TaskEvent, Cloudlet> cloudletCreationFunction)¶ Instantiates a
GoogleTaskEventsTraceReader
to read a “task events” file.Parameters: - simulation – the simulation instance that the created tasks and brokers will belong to.
- filePath – the workload trace relative file name in one of the following formats: ASCII text, zip, gz.
- cloudletCreationFunction – A
Function
that will be called for everyCloudlet
to be created from a line inside the trace file. TheFunction
will receive aTaskEvent
object containing the task data read from the trace and must return a new Cloudlet according to such data.
Throws: - IllegalArgumentException – when the trace file name is null or empty
- UncheckedIOException – when the file cannot be accessed (such as when it doesn’t exist)
See also:
.process()
Methods¶
createBrokerIfAbsent¶
-
protected DatacenterBroker
createBrokerIfAbsent
(String username)¶ Creates a new broker if a previous one with the specified username was not created
Parameters: - username – the username of the broker
Returns: an already existing broker with the given username or a new one if there was no broker with such an username
getBroker¶
-
protected DatacenterBroker
getBroker
()¶ Gets an
DatacenterBroker
instance representing the username from the last trace line read.Returns: the DatacenterBroker
instance
getBrokers¶
-
public List<DatacenterBroker>
getBrokers
()¶ Gets the List of brokers created according to the username from the trace file, representing a customer.
getCloudletCreationFunction¶
getInstance¶
-
public static GoogleTaskEventsTraceReader
getInstance
(CloudSim simulation, String filePath, Function<TaskEvent, Cloudlet> cloudletCreationFunction)¶ Gets a
GoogleTaskEventsTraceReader
instance to read a “task events” trace file inside the application’s resource directory.Parameters: - simulation – the simulation instance that the created tasks and brokers will belong to.
- filePath – the workload trace relative file name in one of the following formats: ASCII text, zip, gz.
- cloudletCreationFunction – A
Function
that will be called for everyCloudlet
to be created from a line inside the trace file. TheFunction
will receive aTaskEvent
object containing the task data read from the trace and must return a new Cloudlet according to such data.
Throws: - IllegalArgumentException – when the trace file name is null or empty
- UncheckedIOException – when the file cannot be accessed (such as when it doesn’t exist)
See also:
.process()
getSimulation¶
-
public Simulation
getSimulation
()¶
preProcess¶
-
protected void
preProcess
()¶ There is no pre-process requirements for this implementation.
process¶
-
public Set<Cloudlet>
process
()¶ Process the
trace file
creating a Set ofCloudlet
s described in the file. Each created Cloudlet is automatically submitted to its respective broker.It returns the Set of all submitted
Cloudlet
s at any timestamp inside the trace file (the timestamp is used to delay the Cloudlet submission).Returns: the Set of all submitted Cloudlet
s for any timestamp inside the trace file.See also:
.getBrokers()
requestCloudletStatusChange¶
-
boolean
requestCloudletStatusChange
(BiFunction<DatacenterBroker, Long, Optional<Cloudlet>> cloudletLookupFunction, int tag)¶ Send a message to the broker to request change in a Cloudlet status, using some tags from
CloudSimTags
such asCloudSimTags.CLOUDLET_READY
.Parameters: - cloudletLookupFunction – a
BiFunction
that receives the broker to find the Cloudlet into and the unique ID of the Cloudlet (task), so that the Cloudlet status can be changed - tag – a tag from the
CloudSimTags
used to send a message to request the Cloudlet status change, such asCloudSimTags.CLOUDLET_FINISH
Returns: true if the request was created, false otherwise
- cloudletLookupFunction – a
setCloudletCreationFunction¶
-
public void
setCloudletCreationFunction
(Function<TaskEvent, Cloudlet> cloudletCreationFunction)¶ Sets a
Function
that will be called for everyCloudlet
to be created from a line inside the trace file. TheFunction
will receive aTaskEvent
object containing the task data read from the trace and should the created Cloudlet. The provided function must instantiate the Host and defines Host’s CPU cores and RAM capacity according the the received parameters. For other Hosts configurations (such as storage capacity), the provided function must define the value as desired, since the trace file doesn’t have any other information for such resources.Parameters: - cloudletCreationFunction – the
Function
to set
- cloudletCreationFunction – the