-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component creation transparency #63
base: pg-merge
Are you sure you want to change the base?
Changes from 4 commits
7d392de
82bec47
90873d2
e14cc95
a57e2e1
8a26f76
3ac067f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,17 +64,17 @@ public abstract class AbstractCommandReceivingComponent extends AbstractComponen | |
/** | ||
* Name of this Docker container. | ||
*/ | ||
private String containerName; | ||
protected String containerName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have all the visibility modifiers been changed? It does not make sense to me. Please explain why it is necessary. |
||
/** | ||
* Name of the queue that is used to receive responses for messages that are | ||
* sent via the command queue and for which an answer is expected. | ||
*/ | ||
private String responseQueueName = null; | ||
protected String responseQueueName = null; | ||
/** | ||
* Mapping of RabbitMQ's correlationIDs to Future objects corresponding | ||
* to that RPC call. | ||
*/ | ||
private Map<String, SettableFuture<String>> responseFutures = Collections.synchronizedMap(new LinkedHashMap<>()); | ||
protected Map<String, SettableFuture<String>> responseFutures = Collections.synchronizedMap(new LinkedHashMap<>()); | ||
/** | ||
* Consumer of the queue that is used to receive responses for messages that | ||
* are sent via the command queue and for which an answer is expected. | ||
|
@@ -291,7 +291,7 @@ protected String createContainer(String imageName, String[] envVariables) { | |
* user-provided array of environment variables | ||
* @return the extended array of environment variables | ||
*/ | ||
protected String[] extendContainerEnvVariables(String[] envVariables) { | ||
public String[] extendContainerEnvVariables(String[] envVariables) { | ||
if (envVariables == null) { | ||
envVariables = new String[0]; | ||
} | ||
|
@@ -334,7 +334,7 @@ protected String[] extendContainerEnvVariables(String[] envVariables) { | |
* container | ||
* @return the name of the container instance or null if an error occurred | ||
*/ | ||
protected String createContainer(String imageName, String containerType, String[] envVariables) { | ||
public String createContainer(String imageName, String containerType, String[] envVariables) { | ||
return createContainer(imageName, containerType, envVariables, null); | ||
} | ||
|
||
|
@@ -461,7 +461,15 @@ protected Future<String> createContainerAsync(String imageName, String container | |
return null; | ||
} | ||
|
||
/** | ||
public Map<String, SettableFuture<String>> getResponseFutures() { | ||
return responseFutures; | ||
} | ||
|
||
public String getResponseQueueName() { | ||
return responseQueueName; | ||
} | ||
|
||
/** | ||
* This method sends a {@link Commands#DOCKER_CONTAINER_STOP} command to | ||
* stop the container with the given id. | ||
* | ||
|
@@ -484,7 +492,7 @@ protected void stopContainer(String containerName) { | |
* @throws IOException | ||
* if a communication problem occurs | ||
*/ | ||
private void initResponseQueue() throws IOException { | ||
public void initResponseQueue() throws IOException { | ||
if (responseQueueName == null) { | ||
responseQueueName = cmdChannel.queueDeclare().getQueue(); | ||
} | ||
|
@@ -554,5 +562,28 @@ public void close() throws IOException { | |
} | ||
super.close(); | ||
} | ||
|
||
public String getContainerName() { | ||
return containerName; | ||
} | ||
|
||
public void setContainerName(String containerName) { | ||
this.containerName = containerName; | ||
} | ||
|
||
public Gson getGson() { | ||
return gson; | ||
} | ||
|
||
public void setGson(Gson gson) { | ||
this.gson = gson; | ||
} | ||
|
||
public void createDummyComponent(byte command, byte[] data, String sessionId, BasicProperties props) { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't we discuss that this method is not necessary in this abstract class? Or is there a reason why it is still here? |
||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,7 @@ public void init() throws Exception { | |
dataGenReceiver = DataReceiverImpl.builder().dataHandler(new DataHandler() { | ||
@Override | ||
public void handleData(byte[] data) { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that is the only change in this class, it does not make sense to me to have it. Please try to avoid changes like that and revert the change here. |
||
receiveGeneratedData(data); | ||
} | ||
}).maxParallelProcessedMsgs(maxParallelProcessedMsgs).queue(getFactoryForIncomingDataQueues(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.hobbit.core.containerservice; | ||
|
||
import org.hobbit.core.components.AbstractCommandReceivingComponent; | ||
/** | ||
* ContainerCreation provides the facility to implement the functionalities | ||
* to create {@link DirectContainerCreator} or {@link RabbitMQContainerCreator} | ||
* @author altaf, sourabh, yamini, melisa | ||
* | ||
*/ | ||
public interface ContainerCreation { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add javadoc comments to all methods of this interface. |
||
|
||
void createDataGenerators(String dataGeneratorImageName, int numberOfDataGenerators, | ||
String[] envVariables, AbstractCommandReceivingComponent dummyComponent); | ||
|
||
void createTaskGenerators(String taskGeneratorImageName, int numberOfTaskGenerators, | ||
String[] envVariables, AbstractCommandReceivingComponent dummyComponent); | ||
|
||
void createEvaluationStorage(String evalStorageImageName, String[] envVariables, | ||
AbstractCommandReceivingComponent dummyComponent); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why these three methods? It does not make much sense to me because of two different reasons:
Apart from that, the container IDs should be returned by the method so that the requesting class can decide where it may want to store the ID. |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.hobbit.core.containerservice; | ||
|
||
import org.hobbit.core.Constants; | ||
import org.hobbit.core.components.AbstractBenchmarkController; | ||
|
||
/** | ||
* Factory that provides functionality to get an instance of {@link ContainerCreation} | ||
* @author altaf, sourabh, yamini, melisa | ||
* | ||
*/ | ||
public class ContainerCreationFactory { | ||
|
||
/** | ||
* This method returns the instance of {@link RabbitMQContainerCreator} or {@link DirectContainerCreator} | ||
* based on the environment variable {@link Constants#RABBIT_CONTAINER_SERVICE} | ||
*/ | ||
public static ContainerCreation getContainerCreationObject(String isRabbitContainerService, AbstractBenchmarkController abstractBenchmarkController) { | ||
if(isRabbitContainerService.equals("true")) { | ||
return new RabbitMQContainerCreator(abstractBenchmarkController); | ||
} | ||
return new DirectContainerCreator(abstractBenchmarkController); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain why you need to change the visibility of this method.