com.elastisys.scale.cloudpool.aws.spot.server.Main Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudpool.aws.spot Show documentation
Show all versions of cloudpool.aws.spot Show documentation
A cloud pool capable of managing a pool of AWS spot instances.
This build module produces an all-in-one "server and application" executable
jar file. When executed, it starts an embedded web server that publishes
the cloud pool REST API endpoint.
package com.elastisys.scale.cloudpool.aws.spot.server;
import com.elastisys.scale.cloudpool.api.CloudPool;
import com.elastisys.scale.cloudpool.api.server.CloudPoolOptions;
import com.elastisys.scale.cloudpool.api.server.CloudPoolServer;
import com.elastisys.scale.cloudpool.aws.commons.poolclient.impl.AwsSpotClient;
import com.elastisys.scale.cloudpool.aws.spot.driver.SpotPoolDriver;
import com.elastisys.scale.cloudpool.commons.basepool.BaseCloudPool;
import com.elastisys.scale.cloudpool.commons.basepool.StateStorage;
import com.elastisys.scale.cloudpool.commons.basepool.driver.CloudPoolDriver;
import com.google.common.eventbus.EventBus;
/**
* Main class for starting the REST API server for the AWS Spot Instance
* {@link CloudPool}.
*/
public class Main {
public static void main(String[] args) throws Exception {
CloudPoolOptions options = CloudPoolServer.parseArgs(args);
StateStorage stateStorage = StateStorage.builder(options.storageDir)
.build();
// event bus on which to send alerts are to be distributed to registered
// email/webhook recipients
EventBus eventBus = new EventBus();
CloudPoolDriver driver = new SpotPoolDriver(new AwsSpotClient(),
eventBus);
CloudPoolServer.main(new BaseCloudPool(stateStorage, driver, eventBus),
args);
}
}