Class GoogleTaskEventsTraceReader

  • All Implemented Interfaces:
    TraceReader

    public final class GoogleTaskEventsTraceReader
    extends TraceReaderBase
    Process "task events" trace files from Google Cluster Data to create Cloudlets belonging to cloud customers (users). Customers are represented as DatacenterBroker 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.

    Check important details at TraceReaderAbstract.

    Since:
    CloudSim Plus 4.0.0
    Author:
    Manoel Campos da Silva Filho
    See Also:
    process()
    • Constructor Detail

      • GoogleTaskEventsTraceReader

        public GoogleTaskEventsTraceReader​(CloudSim simulation,
                                           String filePath,
                                           Function<TaskEvent,​Cloudlet> cloudletCreationFunction)
                                    throws IOException
        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 every Cloudlet to be created from a line inside the trace file. The Function will receive a TaskEvent 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)
        IOException
        See Also:
        process()
    • Method Detail

      • 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 every Cloudlet to be created from a line inside the trace file. The Function will receive a TaskEvent 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()
      • process

        public Set<Cloudlet> process()
        Process the trace file creating a Set of Cloudlets described in the file. Each created Cloudlet is automatically submitted to its respective broker.

        It returns the Set of all submitted Cloudlets at any timestamp inside the trace file (the timestamp is used to delay the Cloudlet submission).

        Returns:
        the Set of all submitted Cloudlets for any timestamp inside the trace file.
        See Also:
        getBrokers()
      • preProcess

        protected void preProcess()
        There is no pre-process requirements for this implementation.
      • postProcess

        protected void postProcess()
        Executes any post-process after the trace file was totally parsed.
      • createTaskEventFromTraceLine

        protected TaskEvent createTaskEventFromTraceLine()
      • setCloudletCreationFunction

        public void setCloudletCreationFunction​(Function<TaskEvent,​Cloudlet> cloudletCreationFunction)
        Sets a Function that will be called for every Cloudlet to be created from a line inside the trace file. The Function will receive a TaskEvent 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
      • getBrokers

        public List<DatacenterBroker> getBrokers()
        Gets the List of brokers created according to the username from the trace file, representing a customer.
        Returns:
      • 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
      • getSimulation

        public Simulation getSimulation()