dataminer-pool-manager/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java

73 lines
2.2 KiB
Java
Raw Normal View History

package org.gcube.dataanalysis.dataminer.poolmanager.service;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Cluster;
import org.gcube.dataanalysis.dataminer.poolmanager.util.CheckMethod;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SVNUpdater;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SendMail;
import org.gcube.dataanalysis.dataminer.poolmanager.util.ServiceConfiguration;
public class StagingJob extends DMPMJob {
private Algorithm algorithm;
private Cluster stagingCluster;
private Cluster rProtoCluster;
private String rProtoVREName;
public StagingJob(
SVNUpdater svnUpdater,
Algorithm algorithm,
Cluster stagingCluster,
Cluster rProtoCluster,
String rProtoVREName) {
super(svnUpdater);
this.algorithm = algorithm;
this.stagingCluster = stagingCluster;
this.rProtoCluster = rProtoCluster;
this.rProtoVREName = rProtoVREName;
}
@Override
protected void execute() {
ServiceConfiguration a = new ServiceConfiguration();
CheckMethod b = new CheckMethod();
SendMail sm = new SendMail();
try {
this.svnUpdater.readRPRotoDeps(this.algorithm);
int ret = this.executeAnsibleWorker(createWorker(this.algorithm, this.stagingCluster, false, "root"));
if (ret == 0) {
if (b.checkMethod(a.getStagingHost(), SecurityTokenProvider.instance.get())
&& (b.algoExists(this.algorithm))) {
sm.sendNotification("", "");
// this.svnUpdater.updateRPRotoDeps(this.algorithm);
this.svnUpdater.updateSVNRProtoAlgorithmList(this.algorithm, this.rProtoVREName,
this.algorithm.getFullname(), "Proto");
// int ret2 = this.executeAnsibleWorker(
// createWorker(this.algorithm, this.rProtoCluster,
// false, "gcube"));
}
}
else sm.sendNotification("", "");
} catch (Exception e) {
e.printStackTrace();
}
}
}