use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method getAsterixBinaryTransferPattern.
public Patterns getAsterixBinaryTransferPattern(String asterixInstanceName, Cluster cluster) throws Exception {
String ccLocationIp = cluster.getMasterNode().getClusterIp();
String destDir = cluster.getWorkingDir().getDir() + File.separator + "asterix";
List<Pattern> ps = new ArrayList<>();
Pattern copyHyracks = createCopyHyracksPattern(asterixInstanceName, cluster, ccLocationIp, destDir);
ps.add(copyHyracks);
boolean copyHyracksToNC = !cluster.getWorkingDir().isNFS();
for (Node node : cluster.getNode()) {
if (copyHyracksToNC) {
Pattern copyHyracksForNC = createCopyHyracksPattern(asterixInstanceName, cluster, node.getClusterIp(), destDir);
ps.add(copyHyracksForNC);
}
}
ps.addAll(createHadoopLibraryTransferPattern(cluster).getPattern());
return new Patterns(ps);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createRemoveAsterixTxnLogs.
private Patterns createRemoveAsterixTxnLogs(AsterixInstance instance) throws Exception {
List<Pattern> patternList = new ArrayList<>();
Cluster cluster = instance.getCluster();
Nodeid nodeid;
Event event;
for (Node node : cluster.getNode()) {
String txnLogDir = node.getTxnLogDir() == null ? cluster.getTxnLogDir() : node.getTxnLogDir();
nodeid = new Nodeid(new Value(null, node.getId()));
event = new Event("file_delete", nodeid, txnLogDir);
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 getLibraryInstallPattern.
public Patterns getLibraryInstallPattern(AsterixInstance instance, String dataverse, String libraryName, String libraryPath) throws Exception {
List<Pattern> patternList = new ArrayList<>();
Cluster cluster = instance.getCluster();
Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
String workingDir = cluster.getWorkingDir().getDir();
String destDir = workingDir + File.separator + "library" + File.separator + dataverse + File.separator + libraryName;
String fileToTransfer = new File(libraryPath).getAbsolutePath();
Iterator<Node> installTargets = cluster.getNode().iterator();
Node installNode = installTargets.next();
String destinationIp = installNode.getClusterIp();
String pargs = username + " " + fileToTransfer + " " + destinationIp + " " + destDir + " " + "unpack";
Event event = new Event("file_transfer", nodeid, pargs);
Pattern p = new Pattern(null, 1, null, event);
patternList.add(p);
if (!cluster.getWorkingDir().isNFS()) {
while (installTargets.hasNext()) {
Node node = installTargets.next();
pargs = username + " " + fileToTransfer + " " + node.getClusterIp() + " " + destDir + " " + "unpack";
event = new Event("file_transfer", nodeid, pargs);
p = new Pattern(null, 1, null, event);
patternList.add(p);
}
pargs = username + " " + fileToTransfer + " " + cluster.getMasterNode().getClusterIp() + " " + destDir + " " + "unpack";
event = new Event("file_transfer", nodeid, pargs);
p = new Pattern(null, 1, null, event);
patternList.add(p);
}
return new Patterns(patternList);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class PatternCreator method createCCStartPattern.
private Pattern createCCStartPattern(String hostId) {
Nodeid nodeid = new Nodeid(new Value(null, hostId));
Event event = new Event("cc_start", nodeid, "");
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 getGenerateLogPattern.
public Patterns getGenerateLogPattern(Cluster cluster, String outputDir) {
List<Pattern> patternList = new ArrayList<>();
Map<String, String> nodeLogs = new HashMap<>();
String username = cluster.getUsername() == null ? System.getProperty("user.name") : cluster.getUsername();
String srcHost = cluster.getMasterNode().getClientIp();
Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
String srcDir = cluster.getMasterNode().getLogDir() == null ? cluster.getLogDir() : cluster.getMasterNode().getLogDir();
String destDir = outputDir + File.separator + "cc";
String pargs = username + " " + srcHost + " " + srcDir + " " + destDir;
Event event = new Event("directory_copy", nodeid, pargs);
Pattern p = new Pattern(null, 1, null, event);
patternList.add(p);
nodeLogs.put(cluster.getMasterNode().getClusterIp(), srcDir);
for (Node node : cluster.getNode()) {
srcHost = node.getClusterIp();
srcDir = node.getLogDir() == null ? cluster.getLogDir() : node.getLogDir();
if (nodeLogs.get(node.getClusterIp()) != null && nodeLogs.get(node.getClusterIp()).equals(srcDir)) {
continue;
}
destDir = outputDir + File.separator + node.getId();
pargs = username + " " + srcHost + " " + srcDir + " " + destDir;
event = new Event("directory_copy", nodeid, pargs);
p = new Pattern(null, 1, null, event);
patternList.add(p);
}
return new Patterns(patternList);
}
Aggregations