Package org.springframework.xd.dirt.core

Examples of org.springframework.xd.dirt.core.Job


    String jobDeploymentPath = new JobDeploymentsPath().setJobName(jobName).setModuleLabel(jobLabel)
        .setModuleSequence(properties.getSequenceAsString()).setContainer(containerAttributes.getId()).build();

    Module module = null;
    Job job = DeploymentLoader.loadJob(client, jobName, jobFactory);
    if (job != null) {
      ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor();
      module = deployModule(moduleDescriptor, properties);

      try {
        // this indicates that the container has deployed the module
        client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(jobDeploymentPath);
View Full Code Here


      String unitName = moduleDeploymentsPath.getDeploymentUnitName();
      String moduleType = moduleDeploymentsPath.getModuleType();

      if (ModuleType.job.toString().equals(moduleType)) {
        Job job = DeploymentLoader.loadJob(client, unitName, this.jobFactory);
        if (job != null) {
          redeployModule(new ModuleDeployment(job, job.getJobModuleDescriptor(),
              deploymentProperties), false);
        }
      }
      else {
        Stream stream = streamMap.get(unitName);
View Full Code Here

   * @param data job deployment request data
   */
  @Override
  protected void onChildAdded(CuratorFramework client, ChildData data) throws Exception {
    String jobName = Paths.stripPath(data.getPath());
    Job job = DeploymentLoader.loadJob(client, jobName, jobFactory);
    deployJob(client, job);
  }
View Full Code Here

   */
  public void recalculateJobStates(CuratorFramework client, PathChildrenCache jobDeployments) throws Exception {
    for (Iterator<String> iterator = new ChildPathIterator<String>(ZooKeeperUtils.stripPathConverter,
        jobDeployments); iterator.hasNext();) {
      String jobName = iterator.next();
      Job job = DeploymentLoader.loadJob(client, jobName, jobFactory);
      if (job != null) {
        String jobModulesPath = Paths.build(Paths.JOB_DEPLOYMENTS, jobName, Paths.MODULES);
        List<ModuleDeploymentStatus> statusList = new ArrayList<ModuleDeploymentStatus>();
        List<String> moduleDeployments = client.getChildren().forPath(jobModulesPath);
        for (String moduleDeployment : moduleDeployments) {
          JobDeploymentsPath jobDeploymentsPath = new JobDeploymentsPath(
              Paths.build(jobModulesPath, moduleDeployment));
          statusList.add(new ModuleDeploymentStatus(
              jobDeploymentsPath.getContainer(),
              jobDeploymentsPath.getModuleSequence(),
              new ModuleDescriptor.Key(jobName, ModuleType.job, jobDeploymentsPath.getModuleLabel()),
              ModuleDeploymentStatus.State.deployed, null));
        }
        DeploymentUnitStatus status = stateCalculator.calculate(job,
            new DefaultModuleDeploymentPropertiesProvider(job), statusList);

        logger.info("Deployment status for job '{}': {}", job.getName(), status);

        String statusPath = Paths.build(Paths.JOB_DEPLOYMENTS, job.getName(), Paths.STATUS);
        Stat stat = client.checkExists().forPath(statusPath);
        if (stat != null) {
          logger.trace("Found old status path {}; stat: {}", statusPath, stat);
          client.delete().forPath(statusPath);
        }
View Full Code Here

    // check for "orphaned" jobs that can be deployed to this new container
    for (ChildData data : jobDeployments.getCurrentData()) {
      String jobName = ZooKeeperUtils.stripPathConverter.convert(data);

      // if job is null this means the job was destroyed or undeployed
      Job job = DeploymentLoader.loadJob(client, jobName, this.jobFactory);
      if (job != null) {
        List<ModuleDeploymentRequestsPath> requestedModules = ModuleDeploymentRequestsPath.getModulesForDeploymentUnit(
            requestedModulesPaths, jobName);
        Set<String> previouslyDeployed = new HashSet<String>();

        for (String deployedModule : client.getChildren().forPath(Paths.build(data.getPath(), Paths.MODULES))) {
          previouslyDeployed.add(Paths.stripPath(new JobDeploymentsPath(Paths.build(data.getPath(),
              Paths.MODULES,
              deployedModule)).getModuleInstanceAsString()));
        }

        for (ModuleDeploymentRequestsPath path : requestedModules) {
          ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor();
          if (shouldDeploy(moduleDescriptor, path, previouslyDeployed)) {
            RuntimeModuleDeploymentProperties moduleDeploymentProperties =
                new RuntimeModuleDeploymentProperties();
            moduleDeploymentProperties.putAll(ZooKeeperUtils.bytesToMap(
                moduleDeploymentRequests.getCurrentData(path.build()).getData()));
View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.core.Job

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.