use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class AsterixEventServiceClient method getFileTransferPattern.
private Pattern getFileTransferPattern(String username, String src, Nodeid srcNode, String destNodeIp, String destDir) {
String pargs = username + " " + src + " " + destNodeIp + " " + destDir;
Event event = new Event("file_transfer", srcNode, pargs);
return new Pattern(null, 1, null, event);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class AsterixEventServiceClient method initTasks.
private void initTasks(Patterns patterns) {
tasks = new EventTask[patterns.getPattern().size()];
pendingTasks.set(tasks.length);
int index = 0;
for (Pattern pattern : patterns.getPattern()) {
tasks[index] = new EventTask(pattern, this);
tasks[index].start();
index++;
}
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createCopyHyracksPattern.
private Pattern createCopyHyracksPattern(String instanceName, Cluster cluster, String destinationIp, String destDir) {
Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
String asterixZipName = AsterixEventService.getAsterixZip().substring(AsterixEventService.getAsterixZip().lastIndexOf(File.separator) + 1);
String fileToTransfer = new File(AsterixEventService.getAsterixDir() + File.separator + instanceName + File.separator + asterixZipName).getAbsolutePath();
String pargs = username + " " + fileToTransfer + " " + destinationIp + " " + destDir + " " + "unpack";
Event event = new Event("file_transfer", nodeid, pargs);
return new Pattern(null, 1, null, event);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method getHDFSBackUpAsterixPattern.
private Patterns getHDFSBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
Cluster cluster = instance.getCluster();
String hdfsUrl = backupConf.getHdfs().getUrl();
String hadoopVersion = backupConf.getHdfs().getVersion();
String hdfsBackupDir = backupConf.getBackupDir();
VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
String workingDir = cluster.getWorkingDir().getDir();
String backupId = Integer.toString(instance.getBackupInfo().size());
String store;
String pargs;
String iodevices;
store = cluster.getStore();
List<Pattern> patternList = new ArrayList<>();
for (Node node : cluster.getNode()) {
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
iodevices = node.getIodevices() == null ? instance.getCluster().getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + store + " " + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " " + backupId + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
Event event = new Event("backup", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
}
return new Patterns(patternList);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method getHDFSRestoreAsterixPattern.
public Patterns getHDFSRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
Cluster cluster = instance.getCluster();
String clusterStore = instance.getCluster().getStore();
String hdfsUrl = backupInfo.getBackupConf().getHdfs().getUrl();
String hadoopVersion = backupInfo.getBackupConf().getHdfs().getVersion();
String hdfsBackupDir = backupInfo.getBackupConf().getBackupDir();
VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
String workingDir = cluster.getWorkingDir().getDir();
int backupId = backupInfo.getId();
String pargs;
List<Pattern> patternList = new ArrayList<>();
for (Node node : cluster.getNode()) {
Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
pargs = workingDir + " " + instance.getName() + " " + iodevices + " " + clusterStore + " " + StorageConstants.METADATA_ROOT + " " + AsterixEventServiceUtil.TXN_LOG_DIR + " " + backupId + " " + " " + hdfsBackupDir + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
Event event = new Event("restore", nodeid, pargs);
patternList.add(new Pattern(null, 1, null, event));
}
return new Patterns(patternList);
}
Aggregations