Search in sources :

Example 1 with Pattern

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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Event(org.apache.asterix.event.schema.pattern.Event)

Example 2 with Pattern

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++;
    }
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern)

Example 3 with Pattern

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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Event(org.apache.asterix.event.schema.pattern.Event) File(java.io.File)

Example 4 with Pattern

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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Node(org.apache.asterix.event.schema.cluster.Node) ArrayList(java.util.ArrayList) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Cluster(org.apache.asterix.event.schema.cluster.Cluster) Event(org.apache.asterix.event.schema.pattern.Event) Patterns(org.apache.asterix.event.schema.pattern.Patterns)

Example 5 with Pattern

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);
}
Also used : Pattern(org.apache.asterix.event.schema.pattern.Pattern) Node(org.apache.asterix.event.schema.cluster.Node) ArrayList(java.util.ArrayList) Nodeid(org.apache.asterix.event.schema.pattern.Nodeid) Value(org.apache.asterix.event.schema.pattern.Value) Cluster(org.apache.asterix.event.schema.cluster.Cluster) Event(org.apache.asterix.event.schema.pattern.Event) Patterns(org.apache.asterix.event.schema.pattern.Patterns)

Aggregations

Pattern (org.apache.asterix.event.schema.pattern.Pattern)32 ArrayList (java.util.ArrayList)24 Patterns (org.apache.asterix.event.schema.pattern.Patterns)24 Event (org.apache.asterix.event.schema.pattern.Event)23 Nodeid (org.apache.asterix.event.schema.pattern.Nodeid)22 Value (org.apache.asterix.event.schema.pattern.Value)22 Node (org.apache.asterix.event.schema.cluster.Node)21 Cluster (org.apache.asterix.event.schema.cluster.Cluster)15 File (java.io.File)5 AsterixInstance (org.apache.asterix.event.model.AsterixInstance)4 AsterixEventServiceClient (org.apache.asterix.event.management.AsterixEventServiceClient)3 Date (java.util.Date)2 AsterixRuntimeState (org.apache.asterix.event.model.AsterixRuntimeState)2 ProcessInfo (org.apache.asterix.event.model.ProcessInfo)2 InstallerException (org.apache.asterix.installer.error.InstallerException)2 FileOutputStream (java.io.FileOutputStream)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1