Skip to content

How to Add Your Properties

Weiwei Chen edited this page Aug 31, 2013 · 16 revisions

If you have a new property to use in WorkflowSim and would like to configure it in the configuration file, below we show the steps:

  1. Assume we would like to add a deadline of a workflow and it's a long variable. In org.workflowsim.utils.Parameters.java, we add:

    private static long deadline;

    public static void init(..., long dl) {

     ... //other parameters
    
     deadline = dl;
    

    }

    public static long getDeadline(){

     return deadline;
    

    } ... Because Parameters is a static object and in this way we can access deadline in any place.

  2. Add parsing in org.workflowsim.utils.ArgumentParser.java

    public ArgumentParser(String[] args) {

     long deadline = 0;
    
     if ...//other parameter parsing
    
     else if (key.equals("deadline")) {
    
             deadline = Long.parseLong(value);
    
     } 
    
     Parameters.init(..., deadline);
    

    }

This means we set the deadline of Parameters while we parsing a config file

3.Add deadline in config.txt

Just add in your config.txt

 deadline = 10000
  1. Then you can get deadline in your scheduler, i.e. in RandomPlanner.java

    long deadline = Parameters.getDeadline();