Skip to content

Commit

Permalink
Merge branch 'main' into create_tid_2
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet authored Jul 17, 2024
2 parents f87d352 + c1a2cf0 commit 814ddb8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public String getId() {
return getType() + " " + switch (getType()) {
case STARTEVENT -> getProcessId() + "(" + getTaskId() + ")";
case SERVICETASK -> getTopic();

default -> "";
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public List<String> getListProcessInstances() {
return listStartProcess.stream().flatMap(t -> t.listProcessInstances.stream()).collect(Collectors.toList());
}


public int getNumberOfRunningThreads() {
return (int) listStartProcess.stream().filter(t->t.isRunning()).count();
}

public int getTotalCreation() {
return listStartProcess.stream().mapToInt(t -> t.nbCreation).sum();
}
Expand Down Expand Up @@ -115,7 +117,9 @@ private class StartProcess implements Runnable {
* the batch number
*/
boolean isOverload = false;

boolean isRunning = false;

Duration durationToCreateProcessInstances;

/**
Expand Down Expand Up @@ -197,10 +201,12 @@ public void run() {
break;
}
}

isRunning=false;
}
public boolean isRunning() {
return isRunning;

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public RunScenarioFlowStartEvent(TaskScheduler scheduler,
super(scenarioStep, runScenario, runResult);
this.scheduler = scheduler;
}
@Override
public String getTopic() {
return getScenarioStep().getTaskId();
}


@Override
public String getTopic() {
Expand All @@ -47,7 +52,9 @@ public String getTopic() {
public void execute() {
stopping = false;
isRunning = true;

startEventRunnable = new StartEventRunnable(scheduler, getScenarioStep(), getRunScenario(), this, runResult);

startEventRunnable.start();
}

Expand Down Expand Up @@ -126,9 +133,11 @@ public void run() {
logger.info("Stop now [" + getId() + "]");
if (nbOverloaded > 0)
runResult.addError(scenarioStep,

"Overloaded:" + "" + nbOverloaded + " TotalCreation:" + totalCreation // total creation we see
+ " TheoricNumberExpectred:" + (scenarioStep.getNumberOfExecutions() * executionBatchNumber)
// expected

+ " Process[" + scenarioStep.getProcessId() + "] Can't create PI at the required frequency");
if (totalFailed > 0)
runResult.addError(scenarioStep,
Expand All @@ -147,9 +156,11 @@ public void run() {
boolean isOverloadSection = false;

// generate process instance in multiple threads

createProcessInstanceThread = new CreateProcessInstanceThread(executionBatchNumber, scenarioStep, runScenario,
runResult);


// creates all process instances, return when finish OR when duration is reach
createProcessInstanceThread.createProcessInstances(durationToCreateProcessInstances);

Expand All @@ -170,8 +181,10 @@ public void run() {
Duration durationToWait = durationToCreateProcessInstances.minusMillis(end - begin);
if (durationToWait.isNegative()) {
durationToWait = Duration.ZERO;

}


// report now
if (runScenario.getRunParameters().showLevelMonitoring() || createProcessInstanceThread.isOverload()) {
logger.info("Step #{}-{}" + " Create (real/scenario)[{}/{} {}]" // Overload marker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public void execute(RunResult runResult) {
logger.info("ScenarioFlow: ------ TheEnd");
}



/**
* Start execution
*
Expand Down Expand Up @@ -118,8 +120,10 @@ private List<RunScenarioFlowBasic> startExecution(List<RunScenarioFlowBasic> lis
runServiceTaskOp.get().pleaseStop();
} else {
if (runServiceTaskOp.isEmpty()) {

RunScenarioFlowServiceTask runServiceTask = new RunScenarioFlowServiceTask(
serviceAccess.getTaskScheduler("serviceTask"), scenarioStep, runScenario, new RunResult(runScenario));

runServiceTask.execute();
listFlows.add(runServiceTask);
} else {
Expand All @@ -137,8 +141,10 @@ private List<RunScenarioFlowBasic> startExecution(List<RunScenarioFlowBasic> lis
runUserTaskOpt.get().pleaseStop();
} else {
if (runUserTaskOpt.isEmpty()) {

RunScenarioFlowUserTask runUserTask = new RunScenarioFlowUserTask(
serviceAccess.getTaskScheduler("userTask"), scenarioStep, 0, runScenario, new RunResult(runScenario));

runUserTask.execute();
listFlows.add(runUserTask);
} else {
Expand All @@ -151,10 +157,12 @@ private List<RunScenarioFlowBasic> startExecution(List<RunScenarioFlowBasic> lis
return listFlows;
}


private Optional<RunScenarioFlowBasic> getFromList(List<RunScenarioFlowBasic> listTasks, String topic) {
return listTasks.stream().filter(t -> t.getTopic().equals(topic)).findFirst();
}


/**
* Wait end of execution. according to the time in the scenario, wait this time
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void warmingUp(RunResult runResult) {
.toList());
}


logger.info("WarmingUp: Start ---- {} operations (Scenario/Policy: serviceTask:{}/{} userTask: {}/{})",
listOperationWarmingUp.size(), // size of operations
warmingUp.useServiceTasks, // scenario allow service task?
Expand All @@ -88,6 +89,7 @@ public void warmingUp(RunResult runResult) {
runScenario.getRunParameters().isUserTask() // pod can run User Task?
);


for (ScenarioStep scenarioStep : listOperationWarmingUp) {
switch (scenarioStep.getType()) {
case STARTEVENT -> {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ __________ __
| | | | \( <_> ) \__\ ___/ \___ \ \___ \ /_____/ / __ \| | /| | ( <_> ) Y Y \/ __ \| | ( <_> ) | \/
|____| |__| \____/ \___ >___ >____ >____ > (____ /____/ |__| \____/|__|_| (____ /__| \____/|__|
\/ \/ \/ \/ \/ \/ \/
(v1.4.0.c)

(v1.4.0)

0 comments on commit 814ddb8

Please sign in to comment.