public CommandLineRunContainer execute(ComputeProperties computeProperties) throws Exception {
    Context context = new Context(computeProperties);

    String userName = null;
    String pass = null;
    ComputeDbApiConnection dbApiConnection = null;
    ComputeDbApiClient dbApiClient = null;

    // check if we are working with database; database default is database=none
    if (!computeProperties.database.equalsIgnoreCase(Parameters.DATABASE_DEFAULT)) {
      userName = computeProperties.molgenisuser;
      pass = computeProperties.molgenispass;

      dbApiConnection =
          new HttpClientComputeDbApiConnection(
              computeProperties.database, computeProperties.port, "/api/v1", userName, pass);
      dbApiClient = new ComputeDbApiClient(dbApiConnection);
    }

    if (computeProperties.showHelp) {
      new HelpFormatter()
          .printHelp("sh molgenis-compute.sh -p parameters.csv", computeProperties.getOptions());
      return commandLineRunContainer;
    }

    if (computeProperties.create) {
      new WorkflowGenerator(computeProperties.createDirName);
      return commandLineRunContainer;
    } else if (computeProperties.clear) {
      File file = new File(Parameters.PROPERTIES);

      if (file.delete()) {
        LOG.info(file.getName() + " is cleared");
      } else {
        LOG.info("Fail to clear " + file.getName());
      }
      return commandLineRunContainer;
    } else if (computeProperties.generate) {
      String toPrint = computeProperties.workFlow;
      LOG.info("Using workflow:         " + new File(toPrint).getAbsolutePath());

      if (defaultsExists(computeProperties)) {
        toPrint = computeProperties.defaults;
        LOG.info("Using defaults:         " + new File(toPrint).getAbsolutePath());
      }

      for (int i = 0; i < computeProperties.getParameterFiles().length; i++) {
        toPrint = computeProperties.getParameterFiles()[i];
        LOG.info("Using parameters:       " + new File(toPrint).getAbsolutePath());
      }

      LOG.info("Using run (output) dir: " + new File(computeProperties.runDir).getAbsolutePath());
      LOG.info("Using backend:          " + computeProperties.backend);
      LOG.info("Using runID:            " + computeProperties.runId + "\n\n");

      generate(context, computeProperties);

      if (Parameters.DATABASE_DEFAULT.equals(
          computeProperties.database)) { // if database none (= off), then do following
        if (computeProperties.list) {
          // list *.sh files in rundir
          File[] scripts =
              new File(computeProperties.runDir)
                  .listFiles(
                      new FilenameFilter() {
                        @Override
                        public boolean accept(File dir, String filename) {
                          return filename.endsWith(".sh");
                        }
                      });

          LOG.info("Generated jobs that are ready to run:");
          if (null == scripts)
            System.out.println(
                "None. Remark: the run (output) directory '"
                    + computeProperties.runDir
                    + "' does not exist.");
          else if (0 == scripts.length) System.out.println("None.");
          else
            for (File script : scripts) {
              System.out.println("- " + script.getName());
            }
        }
      } else {
        String runName = computeProperties.runId;

        String backendUrl = computeProperties.backendUrl;
        String backendName = computeProperties.backend;
        Long pollInterval = Long.parseLong(computeProperties.interval);

        Iterable<Task> tasks = context.getTasks();
        String submitScript = "none";
        if (backendName.equalsIgnoreCase(Parameters.SCHEDULER_PBS)
            || backendName.equalsIgnoreCase(Parameters.SCHEDULER_SLURM)) {
          for (Task task : tasks) {
            String name = task.getName();
            String wrappedScript =
                FileUtils.readFileToString(new File(computeProperties.runDir + "/" + name + ".sh"));
            task.setScript(wrappedScript);
          }
          submitScript =
              FileUtils.readFileToString(new File(computeProperties.runDir + "/submit.sh"));
        }

        // TODO The user env is now written to file
        //				String environment = context.getUserEnvironment();
        //
        //				CreateRunRequest createRunRequest = new CreateRunRequest(runName, backendUrl,
        // pollInterval, tasks,
        //						environment, userName, submitScript);
        //
        //				dbApiClient.createRun(createRunRequest);

        System.out.println(
            "\n Run "
                + computeProperties.runId
                + " is inserted into database on "
                + computeProperties.database);
      }
    }

    if (computeProperties.execute) {
      if (computeProperties.database.equalsIgnoreCase(Parameters.DATABASE_DEFAULT)) {
        String runDir = computeProperties.runDir;
        SystemCommandExecutorImpl exe = new SystemCommandExecutorImpl();
        exe.runCommand("sh " + runDir + "/submit.sh");

        String err = exe.getCommandError();
        String out = exe.getCommandOutput();

        System.out.println("\nScripts are executed/submitted on " + computeProperties.backend);

        System.out.println(out);
        System.out.println(err);

      } else {
        String backendUserName = computeProperties.backenduser;
        String backendPass = computeProperties.backendpass;

        if ((backendPass == null) || (backendUserName == null)) {
          LOG.info("\nPlease specify username and password for computational back-end");
          LOG.info("Use --backenduser[-bu] and --backendpassword[-bp] for this");
          return commandLineRunContainer;
        }

        StartRunRequest startRunRequest =
            new StartRunRequest(computeProperties.runId, backendUserName, backendPass);
        dbApiClient.start(startRunRequest);
        LOG.info(
            "\n"
                + computeProperties.runId
                + "is submitted for execution "
                + computeProperties.backend
                + " by user "
                + backendUserName);
      }
    }
    return commandLineRunContainer;
  }