Skip to content

Commit

Permalink
No you can easily add applications+ improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
CharafeddineMechalikh committed Nov 7, 2019
1 parent 7d976ce commit 7a1954e
Show file tree
Hide file tree
Showing 50 changed files with 26 additions and 302 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## Changelog
# Changelog

## New version 2.2.3 (nov 7th 2019)
* Now you can add applications easily without exiting the code.

## New version 2.2.2 (nov 7th 2019)
* Fixed some minor bugs

## New version 2.2.0 (nov 2nd 2019)
* The code has been improved
* Fixed some minor bugs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ private boolean checkAppFile(String appFile) {
NodeList appList = doc.getElementsByTagName("application");
simulationParameters.APPS_COUNT = appList.getLength();// save the number of apps, this will be used later by
// the tasks generator
simulationParameters.APPLICATIONS_TABLE= new double[appList.getLength()][6];
for (int i = 0; i < appList.getLength(); i++) {
Node appNode = appList.item(i);

Expand All @@ -217,11 +218,8 @@ private boolean checkAppFile(String appFile) {
isElementPresent(appElement, "request_size");
isElementPresent(appElement, "results_size");
isElementPresent(appElement, "task_length");
isElementPresent(appElement, "required_core");

String appName = appElement.getAttribute("name");
// SimualtionParamters.APP_TYPES appType =
// SimualtionParamters.APP_TYPES.valueOf(appName);
isElementPresent(appElement, "required_core");

double max_delay = Double
.parseDouble(appElement.getElementsByTagName("max_delay").item(0).getTextContent());
double container_size = Double
Expand All @@ -234,14 +232,14 @@ private boolean checkAppFile(String appFile) {
.parseDouble(appElement.getElementsByTagName("task_length").item(0).getTextContent());
double required_core = Double
.parseDouble(appElement.getElementsByTagName("required_core").item(0).getTextContent());
int index = getAppIndex(appName);
// save apps parameters
simulationParameters.APPLICATIONS_TABLE[index][0] = max_delay; // max delay in seconds
simulationParameters.APPLICATIONS_TABLE[index][1] = request_size; // avg request size (KB)
simulationParameters.APPLICATIONS_TABLE[index][2] = results_size; // avg downloaded results size (KB)
simulationParameters.APPLICATIONS_TABLE[index][3] = task_length; // avg task length (MI)
simulationParameters.APPLICATIONS_TABLE[index][4] = required_core; // required # of core
simulationParameters.APPLICATIONS_TABLE[index][5] = container_size; // the size of the container (KB)
simulationParameters.APPLICATIONS_TABLE[i][0] = max_delay; // max delay in seconds
simulationParameters.APPLICATIONS_TABLE[i][1] = request_size; // avg request size (KB)
simulationParameters.APPLICATIONS_TABLE[i][2] = results_size; // avg downloaded results size (KB)
simulationParameters.APPLICATIONS_TABLE[i][3] = task_length; // avg task length (MI)
simulationParameters.APPLICATIONS_TABLE[i][4] = required_core; // required # of core
simulationParameters.APPLICATIONS_TABLE[i][5] = container_size; // the size of the container (KB)
}

} catch (Exception e) {
Expand Down Expand Up @@ -271,15 +269,6 @@ private void isAttribtuePresent(Element element, String key) {
throw new IllegalArgumentException(
"Attribure '" + key + "' is not found in '" + element.getNodeName() + "'");
}
}

public int getAppIndex(String appname) {
for (int i = 0; i < simulationParameters.APPLICATIONS.length; i++) {
if (appname.equals(simulationParameters.APPLICATIONS[i]))
return i;
}
SimLog.println("Invalid application scenario " + appname + " check Applications.xml file");
Runtime.getRuntime().exit(0);
return -1;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public static enum TYPES { // Types of resources
public static String[] ORCHESTRATION_ARCHITECTURES; // The used paradigms : Cloud, Edge, Fog..
public static boolean ENABLE_REGISTRY; // To download the container image or execute the task directly
public static int APPS_COUNT; // The number of the applications specified by the user in the Application.xml file
public static String[] APPLICATIONS = { "AUGMENTED_REALITY", "E_HEALTH", "HEAVY_COMP_APP", "SMART_HOME" }; // The applications that are used
public static double[][] APPLICATIONS_TABLE = new double[APPLICATIONS.length][6]; // The applications characteristics
public static double[][] APPLICATIONS_TABLE; // The applications characteristics
public static String CPU_ALLOCATION_POLICY; // CPU allocation policy : TIME_SHARED (results in long simulation time) or SPACE_SHARED
public static String DEPLOY_ORCHESTRATOR=""; // The location where the orchestrators are deployed (Edge devices, Cloud, Fog servers)
public static boolean WAIT_FOR_TASKS; // After the end of the simulation time, some tasks may still not be executed yet,
Expand Down

This file was deleted.

Loading

0 comments on commit 7a1954e

Please sign in to comment.