Package azkaban.common.utils

Examples of azkaban.common.utils.Props


    @Override
    public void execute(Props parentProps, final FlowCallback callback)
    {
        if (parentProps == null) {
            parentProps = new Props();
        }

        synchronized (sync) {
            if (this.parentProps == null) {
                this.parentProps = parentProps;
View Full Code Here


            for (ExecutableFlow flow : flows) {
                switch (flow.getStatus()) {
                    case FAILED:
                        jobState = Status.FAILED;
                        returnProps = new Props();
                        return;
                    case COMPLETED:
                    case SUCCEEDED:
                        continue;
                    default:
                        allComplete = false;
                }
            }

            if (allComplete) {
                jobState = Status.SUCCEEDED;

                returnProps = new Props();

                for (ExecutableFlow flow : flows) {
                    returnProps = new Props(returnProps, flow.getReturnProps());
                }

                returnProps.logProperties("Output properties for " + getName());
            }
        }
View Full Code Here

            switch (jobState) {
                case RUNNING:
                    return false;
                default:
                    jobState = Status.COMPLETED;
                    parentProps = new Props();
                    returnProps = new Props();
            }
        }

        return true;
    }
View Full Code Here

        for (ExecutableFlow flow : flows) {
            if (flow.getStatus() == Status.READY) {
                continue;
            }

            final Props childsParentProps = flow.getParentProps();
           
            if (parentProps == null) {
                parentProps = childsParentProps;
            }
            else {
View Full Code Here

       }
    @Override
    public Props getJobGeneratedProperties()
    {
      return new Props();
    }
View Full Code Here


      @Override
      public Props getJobGeneratedProperties()
      {
        return new Props();
      }
View Full Code Here

        return periodStr;
    }

    private HashMap<String,Object> loadLegacyFile(File schedulefile) {
        Props schedule = null;
        try {
            schedule = new Props(null, schedulefile.getAbsolutePath());
        } catch(Exception e) {
            throw new RuntimeException("Error loading schedule from " + schedulefile);
        }

        ArrayList<Object> jobScheduleList = new ArrayList<Object>();
        for(String key: schedule.getKeySet()) {
          HashMap<String,Object> scheduledMap = parseScheduledJob(key, schedule.get(key));
          if (scheduledMap == null) {
            jobScheduleList.add(scheduledMap);
          }
        }
View Full Code Here

        if(jobNames.size() < 1)
            cl.printHelpAndExit(helpMessage, System.err);

        // parse override properties
        boolean ignoreDeps = options.has(ignoreDepsOpt);
        Props overrideProps = new Props(null);
        for(String override: options.valuesOf(overrideOpt)) {
            String[] pieces = override.split("=");
            if(pieces.length != 2)
                Utils.croak("Invalid property override: '" + override
                            + "', properties must be in the form key=value", 1);
            overrideProps.put(pieces[0], pieces[1]);
        }

        NamedPermitManager permitManager = new NamedPermitManager();
        permitManager.createNamedPermit("default", cl.getNumWorkPermits());
View Full Code Here

                return null;
            }
        }).once();

        final Props intermediateReturnProps = new Props();
        intermediateReturnProps.put("some","value1--");
        intermediateReturnProps.put("other", "value2--");
        EasyMock.expect(dependeeFlow.getReturnProps()).andReturn(intermediateReturnProps).times(2);
       
        final Capture<FlowCallback> dependerCallback = new Capture<FlowCallback>();
        final Capture<Props> intermediatePropsCap = new Capture<Props>();
        dependerFlow.execute(EasyMock.capture(intermediatePropsCap), EasyMock.capture(dependerCallback));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>()
        {
            @Override
            public Object answer() throws Throwable
            {
                Assert.assertTrue("Dependee must run before depender", dependeeRan.get());
                Assert.assertEquals(Status.RUNNING, flow.getStatus());

                dependerCallback.getValue().completed(Status.SUCCEEDED);

                return null;
            }
        }).once();

        EasyMock.expect(dependerFlow.getExceptions()).andReturn(emptyExceptions).times(1);
       
        EasyMock.reset(props);
        EasyMock.expect(props.equalsProps(props)).andReturn(true).once();

        EasyMock.replay(dependerFlow, dependeeFlow, props);

        Assert.assertEquals(Status.READY, flow.getStatus());

        AtomicBoolean callbackRan = new AtomicBoolean(false);
        flow.execute(
                props,
                new OneCallFlowCallback(callbackRan) {
                    @Override
                    protected void theCallback(Status status)
                    {
                        Assert.assertEquals(Status.SUCCEEDED, status);
                    }
                });

        Assert.assertTrue("Internal flow executes never ran.", dependeeRan.get());
        Assert.assertTrue("Callback didn't run.", callbackRan.get());
        Assert.assertEquals(Status.SUCCEEDED, flow.getStatus());
        Assert.assertEquals(emptyExceptions, flow.getExceptions());
        Assert.assertEquals(props, flow.getParentProps());

        final Props intProps = intermediatePropsCap.getValue().local();
        Assert.assertTrue(intProps != null);
        Assert.assertEquals(2, intProps.size());
        Assert.assertEquals("value1--", intProps.get("some"));
        Assert.assertEquals("value2--", intProps.get("other"));

        callbackRan = new AtomicBoolean(false);
        flow.execute(
                props,
                new OneCallFlowCallback(callbackRan) {
                    @Override
                    protected void theCallback(Status status)
                    {
                        Assert.assertEquals(Status.SUCCEEDED, status);
                    }
                });

        Assert.assertTrue("Callback didn't run.", callbackRan.get());
        Assert.assertEquals(Status.SUCCEEDED, flow.getStatus());
        Assert.assertEquals(emptyExceptions, flow.getExceptions());

        EasyMock.verify(props, dependerFlow);
        EasyMock.reset(props, dependerFlow);

        final Props someProps = new Props();
        someProps.put("some", "yay");
        someProps.put("something", "you");
        EasyMock.expect(dependerFlow.getReturnProps()).andReturn(someProps).times(1);
        EasyMock.expect(props.equalsProps(props)).andReturn(false).once();

        EasyMock.replay(props, dependerFlow);

        final Props retProps = flow.getReturnProps();
        final Props expectedProps = new Props();
        expectedProps.put("some", "yay");
        expectedProps.put("something", "you");
        expectedProps.put("other", "value2--");

        Assert.assertTrue(
                String.format("Return props should be the combination of all sub-flow return props[%s].  Was[%s]", expectedProps, retProps),
                retProps.equalsProps(expectedProps)
        );
View Full Code Here

                dependeeCallback.getValue().completed(Status.SUCCEEDED);

                return null;
            }
        }).once();
        EasyMock.expect(dependeeFlow.getReturnProps()).andReturn(new Props());

        final Capture<FlowCallback> dependerCallback = new Capture<FlowCallback>();
        dependerFlow.execute(EasyMock.isA(Props.class), EasyMock.capture(dependerCallback));
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>()
        {
View Full Code Here

TOP

Related Classes of azkaban.common.utils.Props

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.