Package azkaban.util.process

Examples of azkaban.util.process.AzkabanProcessBuilder


public class ProcessTest {
   
 
    @Test
    public void helloWorld() throws Exception {
        AzkabanProcess process = new AzkabanProcessBuilder("echo", "hello", "world").build();
        assertTrue("Process is not started.", !process.isStarted());
        assertTrue("Process is not running.", !process.isRunning());
        process.run();
        assertTrue("Process should be set.", process.getProcessId() > 0);
        assertTrue("After running, process should be complete.", process.isComplete());
View Full Code Here


        assertTrue("Process is not running.", !process.isRunning());
    }
   
    @Test(expected = ProcessFailureException.class)
    public void testFailOnNonZeroExitCode() throws Exception {
        new AzkabanProcessBuilder("ls", "alkdjfalsjdflkasdjf").build().run();
    }
View Full Code Here

        new AzkabanProcessBuilder("ls", "alkdjfalsjdflkasdjf").build().run();
    }
   
    @Test(expected = IOException.class)
    public void testFailOnBadCommand() throws Exception {
        new AzkabanProcessBuilder("alkdjfalsjdflkasdjf").build().run();
    }
View Full Code Here

     
    @Test
    public void testKill() throws Exception {
        ExecutorService executor = Executors.newFixedThreadPool(2);
       
        AzkabanProcess p1 = new AzkabanProcessBuilder("sleep", "10").build();
        runInSeperateThread(executor, p1);
        assertTrue("Soft kill should interrupt sleep.", p1.softKill(5, TimeUnit.SECONDS));
        p1.awaitCompletion();
       
        AzkabanProcess p2 = new AzkabanProcessBuilder("sleep", "10").build();
        runInSeperateThread(executor, p2);
        p2.hardKill();
        p2.awaitCompletion();
        assertTrue(p2.isComplete());
    }
View Full Code Here

    public LongArgJob(String[] command, JobDescriptor desc, Set<String> suppressedKeys) {
        //super(command, desc);
         super(desc);
        //String cwd = descriptor.getProps().getString(WORKING_DIR, new File(descriptor.getFullPath()).getParent());
      
        this.builder = new AzkabanProcessBuilder(command).
            setEnv(getProps().getMapByPrefix(ENV_PREFIX)).
            setWorkingDir(getCwd()).
            setLogger(getLog());
        appendProps(suppressedKeys);
    }
View Full Code Here

    public double getProgress() {
        return process != null && process.isComplete()? 1.0 : 0.0;
    }

    private void appendProps(Set<String> suppressed) {
        AzkabanProcessBuilder builder = this.getBuilder();
        Props props = getProps();
        for(String key: props.getKeySet())
            if(!suppressed.contains(key))
                builder.addArg("--" + key, props.get(key));
    }
View Full Code Here

TOP

Related Classes of azkaban.util.process.AzkabanProcessBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.