Get executable proposed plan(if any) for display or execution.
19092
def run_command(self, ct, cluster_balancer):
        """"""
        if self.args.topic in ct.topics:
            topic = ct.topics[self.args.topic]
        else:
            self.log.error(
                "Topic {topic} not found. Exiting."
                .format(topic=self.args.topic),
            )
            sys.exit(1)

        if topic.replication_factor == self.args.replication_factor:
            self.log.info(
                "Topic {topic} already has replication factor {rf}. "
                "No action to perform."
                .format(topic=topic.id, rf=self.args.replication_factor),
            )
            return

        if self.args.replication_factor > len(ct.brokers):
            self.log.error(
                "Replication factor {rf} is greater than the total number of "
                "brokers {brokers}. Exiting."
                .format(
                    rf=self.args.replication_factor,
                    brokers=len(ct.brokers)
                ),
            )
            sys.exit(1)

        base_assignment = ct.assignment

        changes_per_partition = abs(
            self.args.replication_factor - topic.replication_factor
        )

        if topic.replication_factor < self.args.replication_factor:
            self.log.info(
                "Increasing topic {topic} replication factor from {old_rf} to "
                "{new_rf}."
                .format(
                    topic=topic.id,
                    old_rf=topic.replication_factor,
                    new_rf=self.args.replication_factor,
                ),
            )
            for partition in topic.partitions:
                cluster_balancer.add_replica(
                    partition.name,
                    changes_per_partition,
                )
        else:
            self.log.info(
                "Decreasing topic {topic} replication factor from {old_rf} to "
                "{new_rf}."
                .format(
                    topic=topic.id,
                    old_rf=topic.replication_factor,
                    new_rf=self.args.replication_factor,
                ),
            )
            topic_data = self.zk.get_topics(topic.id)[topic.id]
            for partition in topic.partitions:
                partition_data = topic_data['partitions'][str(partition.partition_id)]
                isr = partition_data['isr']
                osr_broker_ids = [b.id for b in partition.replicas if b.id not in isr]
                if osr_broker_ids:
                    self.log.info(
                        "The out of sync replica(s) {osr_broker_ids} will be "
                        "prioritized for removal."
                        .format(osr_broker_ids=osr_broker_ids)
                    )
                cluster_balancer.remove_replica(
                    partition.name,
                    osr_broker_ids,
                    changes_per_partition,
                )

        # Each replica addition/removal for each partition counts for one
        # partition movement
        partition_movement_count = len(topic.partitions) * changes_per_partition

        reduced_assignment = self.get_reduced_assignment(
            base_assignment,
            ct,
            max_partition_movements=partition_movement_count,
            max_leader_only_changes=0,
        )
        self.process_assignment(reduced_assignment, allow_rf_change=True)
507130
def get_plan(self, plan_code):
        
        return self.client._get(self.url + 'plans/{}'.format(plan_code), headers=self.get_headers())
495488
def executable(self):
        
        return util.find_executable(self.BINS[0], os.path.join("bin", self.BINS[0]) )
654598
private Optional<File> which(final String executableName) {
    String systemPath = System.getenv("PATH");
    String[] pathDirs = systemPath.split(File.pathSeparator);
    
    Optional<File> fullyQualifiedExecutable = Optional.absent();
    for(final String pathDir : pathDirs) {
      File file = new File(pathDir, executableName);
      if (file.isFile()) {
        fullyQualifiedExecutable = Optional.of(file);
        break;
      }
    }
    return fullyQualifiedExecutable;
  }
758156
def plan(action_class, targets, *args)
      check_targets!(targets)
      plan_self(:action_class => action_class.to_s,
                :target_ids => targets.map(&:id),
                :target_class => targets.first.class.to_s,
                :args => args)
    end
999567
def _plan_on_valid_line(self, at_line, final_line_count):
        """"""
        # Put the common cases first.
        if at_line == 1 or at_line == final_line_count:
            return True

        # The plan may only appear on line 2 if the version is at line 1.
        after_version = (
            self._lines_seen["version"]
            and self._lines_seen["version"][0] == 1
            and at_line == 2
        )
        if after_version:
            return True

        return False
726752
def available_for_entry_point(self, entry_point):
        """"""
        if self.entry_point == ALL or entry_point == ALL:
            return True

        return entry_point in ensure_sequence(self.entry_point)
308514
def check_executables():
    """"""
    print("\033[1mCheck executables\033[0m")
    required_executables = [utils.get_nntoolkit()]
    for executable in required_executables:
        path = which(executable)
        if path is None:
            print("%s ... %sNOT%s found" % (executable, Bcolors.WARNING,
                                            Bcolors.ENDC))
        else:
            print("%s ... %sfound%s at %s" % (executable, Bcolors.OKGREEN,
                                              Bcolors.ENDC, path))
136846
public static ExecutionPlan getExecutionPlanFromBytes(byte[] bytes) {

        try (ByteArrayInputStream is = new ByteArrayInputStream(bytes);
             BufferedInputStream bis = new BufferedInputStream(is);
             GZIPInputStream gis = new GZIPInputStream(bis);
             BufferedInputStream bis_2 = new BufferedInputStream(gis);
             ObjectInputStream ois = new ObjectInputStream(bis_2);
        ) {

            return (ExecutionPlan) ois.readObject();

        } catch (IOException | ClassNotFoundException ex) {
            logger.error("Failed to read execution plan from byte[]. Error: ", ex);
            throw new RuntimeException("Failed to read execution plan from byte[]. Error: ", ex);
        }
  }
192996
def execPath(self):
        """"""
        vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)
        return self.installedApp.exec_path(vers)
417440
def _get_or_create_run(build):
    """"""
    release_name, release_number = _get_release_params()
    run_name = request.form.get('run_name', type=str)
    utils.jsonify_assert(run_name, 'run_name required')

    release = (
        models.Release.query
        .filter_by(build_id=build.id, name=release_name, number=release_number)
        .first())
    utils.jsonify_assert(release, 'release does not exist')

    run = (
        models.Run.query
        .filter_by(release_id=release.id, name=run_name)
        .first())
    if not run:
        # Ignore re-reports of the same run name for this release.
        logging.info('Created run: build_id=%r, release_name=%r, '
                     'release_number=%d, run_name=%r',
                     build.id, release.name, release.number, run_name)
        run = models.Run(
            release_id=release.id,
            name=run_name,
            status=models.Run.DATA_PENDING)
        db.session.add(run)
        db.session.flush()

    return release, run
308988
private Plan getPlan() throws ProgramInvocationException {
		if (this.plan == null) {
			Thread.currentThread().setContextClassLoader(this.userCodeClassLoader);
			this.plan = createPlanFromProgram(this.program, this.args);
		}

		return this.plan;
	}
424664
def get_fn_plan(callback=None, out_callback=None, name='pycbc_cufft', parameters=None):
    
    if parameters is None:
        parameters = []
    source = fftsrc.render(input_callback=callback, output_callback=out_callback, parameters=parameters)
    path = compile(source, name)
    lib = ctypes.cdll.LoadLibrary(path)
    fn = lib.execute
    fn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
    plan = lib.create_plan
    plan.restype = ctypes.c_void_p
    plan.argyptes = [ctypes.c_uint]
    return fn, plan
177596
def plan_scripts(self):
        
        if not self.__plan_scripts:
            self.__plan_scripts = PlanScripts(self.__connection)
        return self.__plan_scripts
1239263
def execute_plan(plan=None):
    """"""
    execution_result = list()
    for task in plan:
        action = task['action']
        if action == 'delete':
            command = generate_delete_user_command(username=task.get('username'), manage_home=task['manage_home'])
            command_output = execute_command(command)
            execution_result.append(dict(task=task, command_output=command_output))
            remove_sudoers_entry(username=task.get('username'))
        elif action == 'add':
            command = generate_add_user_command(proposed_user=task.get('proposed_user'), manage_home=task['manage_home'])
            command_output = execute_command(command)
            if task['proposed_user'].public_keys and task['manage_home'] and task['manage_keys']:
                write_authorized_keys(task['proposed_user'])
            if task['proposed_user'].sudoers_entry:
                write_sudoers_entry(username=task['proposed_user'].name,
                                    sudoers_entry=task['proposed_user'].sudoers_entry)
            execution_result.append(dict(task=task, command_output=command_output))
        elif action == 'update':
            result = task['user_comparison'].get('result')
            # Don't modify user if only keys have changed
            action_count = 0
            for k, _ in iteritems(result):
                if '_action' in k:
                    action_count += 1
            command_output = None
            if task['manage_home'] and task['manage_keys'] and action_count == 1 and 'public_keys_action' in result:
                write_authorized_keys(task['proposed_user'])
            elif action_count == 1 and 'sudoers_entry_action' in result:
                write_sudoers_entry(username=task['proposed_user'].name,
                                    sudoers_entry=task['user_comparison']['result']['replacement_sudoers_entry'])
            else:
                command = generate_modify_user_command(task=task)
                command_output = execute_command(command)
                if task['manage_home'] and task['manage_keys'] and result.get('public_keys_action'):
                    write_authorized_keys(task['proposed_user'])
                if result.get('sudoers_entry_action'):
                    write_sudoers_entry(username=task['proposed_user'].name,
                                        sudoers_entry=task['user_comparison']['result']['replacement_sudoers_entry'])
            execution_result.append(dict(task=task, command_output=command_output))
860588
private static Optional<File> findExecutableOnSystemPath(final String executableName) {
    for (final String pathPath : Splitter.on(File.pathSeparator).split(System.getenv("PATH"))) {
      final File probeFile = new File(pathPath, executableName);
      if (probeFile.isFile() && java.nio.file.Files.isExecutable(probeFile.toPath())) {
        return Optional.of(probeFile);
      }
    }
    return Optional.absent();
  }
793596
private function _fetch_site_plan( $plan_id = false ) {
            $this->_logger->entrance();
            $api = $this->get_api_site_scope();

            if ( ! is_numeric( $plan_id ) ) {
                $plan_id = $this->_site->plan_id;
            }

            $plan = $api->get( "/plans/{$plan_id}.json", true );

            return ! isset( $plan->error ) ? new FS_Plugin_Plan( $plan ) : $plan;
        }