Package azkaban.common.utils

Examples of azkaban.common.utils.Props


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

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

        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


        EasyMock.expect(dependeeFlow.getStartTime()).andReturn(expectedStartTime).times(1);
        EasyMock.expect(dependeeFlow.getParentProps()).andReturn(props).times(1);

        Capture<FlowCallback> dependeeFlowCallback = new Capture<FlowCallback>();
        dependeeFlow.execute(EasyMock.eq(props), EasyMock.capture(dependeeFlowCallback));
        EasyMock.expect(dependeeFlow.getReturnProps()).andReturn(new Props()).once();

        Capture<FlowCallback> dependerFlowCallback = new Capture<FlowCallback>();
        dependerFlow.execute(EasyMock.isA(Props.class), EasyMock.capture(dependerFlowCallback));

//<<<<<<< HEAD:azkaban/src/unit/azkaban/flow/ComposedExecutableFlowTest.java
View Full Code Here

        InputStream reader = null;
        try {
            System.err.println("output properties file=" + outputPropertiesFile.getAbsolutePath());
            reader = new BufferedInputStream(new FileInputStream(outputPropertiesFile));

            Props outputProps = new Props();
            final String content = Streams.asString(reader).trim();
           
            if (!content.isEmpty()) {
                Map<String, Object> propMap = jsonToJava.apply(new JSONObject(content));

                for (Map.Entry<String, Object> entry : propMap.entrySet()) {
                    outputProps.put(entry.getKey(), entry.getValue().toString());
                }
            }
            return outputProps;
        }
        catch (FileNotFoundException e) {
            log.info(String.format("File[%s] wasn't found, returning empty props.", outputPropertiesFile));
            return new Props();
        }
        catch (Exception e) {
            log.error("Exception thrown when trying to load output file props.  Returning empty Props instead of failing.  Is this really the best thing to do?", e);
            return new Props();
        }
        finally {
            IOUtils.closeQuietly(reader);
        }
    }
View Full Code Here

        final DateTime expectedStartTime = new DateTime(0);

        EasyMock.expect(dependerFlow.getStatus()).andReturn(Status.RUNNING).once();
        EasyMock.expect(dependeeFlow.getStartTime()).andReturn(expectedStartTime).times(2);
        EasyMock.expect(dependeeFlow.getParentProps()).andReturn(props).once();
        EasyMock.expect(dependeeFlow.getReturnProps()).andReturn(new Props()).once();

        Capture<FlowCallback> dependerFlowCallback = new Capture<FlowCallback>();
        dependerFlow.execute(EasyMock.isA(Props.class), EasyMock.capture(dependerFlowCallback));

        EasyMock.expect(dependerFlow.getExceptions()).andReturn(emptyExceptions).times(1);
View Full Code Here

      logger.debug("Loading default properties from " + confDir);
      defaultProps = PropsUtils.loadPropsInDir(new File(confDir.trim()),
          ".properties", ".schema");
    } else {
      logger.debug("No configuration options given (missing -c option).");
      defaultProps = new Props();
    }

    numWorkPermits = defaultProps.getInt("total.work.permits",
        Integer.MAX_VALUE);
    classloader = getHadoopClassLoader();
View Full Code Here

    public void execute(ExecutableFlow flow) {
      if (isExecuting(flow.getName())) {
        throw new JobExecutionException("Job " + flow.getName() + " is already running.");
      }
     
        final Props parentProps = produceParentProperties(flow);
        FlowExecutionHolder holder = new FlowExecutionHolder(flow, parentProps);
        logger.info("Executing job '" + flow.getName() + "' now");

        final JobExecution executingJob = new JobExecution(flow.getName(),
                                                       new DateTime(),
View Full Code Here

            }
        }
    }
   
    private Props produceParentProperties(final ExecutableFlow flow) {
        Props parentProps = new Props();

        parentProps.put("azkaban.flow.id", flow.getId());
        parentProps.put("azkaban.flow.uuid", UUID.randomUUID().toString());

        DateTime loadTime = new DateTime();

        parentProps.put("azkaban.flow.start.timestamp", loadTime.toString());
        parentProps.put("azkaban.flow.start.year", loadTime.toString("yyyy"));
        parentProps.put("azkaban.flow.start.month", loadTime.toString("MM"));
        parentProps.put("azkaban.flow.start.day", loadTime.toString("dd"));
        parentProps.put("azkaban.flow.start.hour", loadTime.toString("HH"));
        parentProps.put("azkaban.flow.start.minute", loadTime.toString("mm"));
        parentProps.put("azkaban.flow.start.seconds", loadTime.toString("ss"));
        parentProps.put("azkaban.flow.start.milliseconds", loadTime.toString("SSS"));
        parentProps.put("azkaban.flow.start.timezone", loadTime.toString("ZZZZ"));
        return parentProps;
    }
View Full Code Here

  public void setUp() {
   
    /*  initialize job */
    descriptor = EasyMock.createMock(JobDescriptor.class);
   
    props = new Props();
    props.put(AbstractProcessJob.WORKING_DIR, ".");
   
    EasyMock.expect(descriptor.getId()).andReturn("process").times(1);
    EasyMock.expect(descriptor.getResolvedProps()).andReturn(props).times(1);
    EasyMock.expect(descriptor.getFullPath()).andReturn(".").times(1);
View Full Code Here

        JobManager jobManager = app.getJobManager();
        Map<String, JobDescriptor> descriptors = jobManager.loadJobDescriptors();
        boolean isEditing = req.getParameter("edit") != null;
        if(jobId == null) {
            Page page = newPage(req, resp, "azkaban/web/pages/edit_job.vm");
            page.add("jsonData", getJSONText(new Props()));
            page.render();
        } else if(isEditing) {
            Page page = newPage(req, resp, "azkaban/web/pages/edit_job.vm");
            JobDescriptor jdesc = descriptors.get(jobId);
View Full Code Here

                break;
            if(key.length() > 0)
                props.put(key, val);
        }
        try {
            jobManager.deployJob(jobName, jobPath, new Props(null, props));
            addMessage(req, jobName + " has been deployed to " + jobPath);
            resp.sendRedirect(req.getContextPath() + "/job?id=" + jobName);
        } catch(Exception e) {
            logger.error("Failed to deploy job.", e);
            addError(req, "Failed to deploy job: " + e.getMessage());
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.