Capture a snapshot of this process executor's main state.
975812
private ProcessAttributes getAttributes() {
    return new ProcessAttributes(
          getCommand(),
          getDirectory(),
          new LinkedHashMap<String, String>(environment),
          allowedExitValues == null ? null : new HashSet<Integer>(allowedExitValues));
  }
182382
def rec(self):
        """"""

        try:
            self._snapshot()
        except Exception as e:
            self.log("Timer error: ", e, type(e), lvl=error)
480248
private CompletableFuture<Void> handleSnapshot() {
    return Futures.allOf(partitions.values().stream()
        .map(partition -> partition.snapshot())
        .collect(Collectors.toList()))
        .thenApply(v -> null);
  }
201807
def capture_output_from_running_process(context: RunContext) -> None:
    
    # Get the raw output one line at a time
    _output = context.capture.readline(block=False)

    if _output:

        line = decode_and_filter(_output, context)

        if line:
            if not context.mute:

                # Print in real time
                _LOGGER_PROCESS.debug(line)

            # Buffer the line
            context.process_output_chunks.append(line)

        # Get additional output if any
        return capture_output_from_running_process(context)

    return None
1100701
def __initialize_snapshot(self):
        
        if not self.__processDict:
            try:
                self.scan_processes()       # remote desktop api (relative fn)
            except Exception:
                self.scan_processes_fast()  # psapi (no filenames)
            self.scan_process_filenames()
327296
@Override
	public void snapshotState(FunctionSnapshotContext context) throws Exception {
		Preconditions.checkState(this.checkpointedState != null,
			"The " + getClass().getSimpleName() + " has not been properly initialized.");

		if (LOG.isDebugEnabled()) {
			LOG.debug("{} checkpointing: Messages: {}, checkpoint id: {}, timestamp: {}",
				idsForCurrentCheckpoint, context.getCheckpointId(), context.getCheckpointTimestamp());
		}

		pendingCheckpoints.addLast(new Tuple2<>(context.getCheckpointId(), idsForCurrentCheckpoint));
		idsForCurrentCheckpoint = new HashSet<>(64);

		this.checkpointedState.clear();
		this.checkpointedState.add(SerializedCheckpointData.fromDeque(pendingCheckpoints, idSerializer));
	}
271636
private void keepAliveSession(long index, long timestamp, long commandSequence, long eventIndex, ServerSessionContext session, CompletableFuture<Void> future, ThreadContext context) {
    if (!log.isOpen()) {
      context.executor().execute(() -> future.completeExceptionally(new IllegalStateException("log closed")));
      return;
    }

    // If the session is already in an inactive state, complete the future exceptionally.
    if (!session.state().active()) {
      context.executor().execute(() -> future.completeExceptionally(new UnknownSessionException("inactive session: " + session.id())));
      return;
    }

    // Trigger scheduled callbacks in the state machine.
    executor.tick(index, timestamp);

    // Update the state machine context with the keep-alive entry's index. This ensures that events published
    // as a result of asynchronous callbacks will be executed at the proper index with SEQUENTIAL consistency.
    executor.init(index, Instant.ofEpochMilli(timestamp), ServerStateMachineContext.Type.COMMAND);

    session.clearResults(commandSequence).resendEvents(eventIndex);

    // Calculate the last completed index.
    long lastCompleted = calculateLastCompleted(index);

    // Callbacks in the state machine may have been triggered by the execution of the keep-alive.
    // Get any futures for scheduled tasks and await their completion, then update the highest
    // index completed for all sessions to allow log compaction to progress.
    executor.commit();
    context.executor().execute(() -> {
      setLastCompleted(lastCompleted);
      future.complete(null);
    });
  }
1295547
public synchronized TimeCounter snapshot(boolean reset) {
		TimeCounter s = new TimeCounter();

		if (reset) {
			s.count.set(count.getAndSet(0));
			s.total.set(total.getAndSet(0));
			s.min.set(min.getAndSet(0));
			s.max.set(max.getAndSet(0));
		} else {
			s.count.set(count.get());
			s.total.set(total.get());
			s.min.set(min.get());
			s.max.set(max.get());
		}
		return s;
	}
761169
public void loadSnapshot(String vm, String snapshotUuid) {
        if (!EnumSet.of(POWEROFF, SAVED).contains(vmState(vm))) {
            powerOff(vm);
        }
        execute("snapshot", vm, "restore", snapshotUuid);
        start(vm);
    }
645181
public HashMap<StreamShardMetadata, SequenceNumber> snapshotState() {
		// this method assumes that the checkpoint lock is held
		assert Thread.holdsLock(checkpointLock);

		HashMap<StreamShardMetadata, SequenceNumber> stateSnapshot = new HashMap<>();
		for (KinesisStreamShardState shardWithState : subscribedShardsState) {
			stateSnapshot.put(shardWithState.getStreamShardMetadata(), shardWithState.getLastProcessedSequenceNum());
		}
		return stateSnapshot;
	}
343994
def get_snapshot(number=0, config='root'):
    '''
    
    '''
    try:
        snapshot = snapper.GetSnapshot(config, int(number))
        return _snapshot_to_data(snapshot)
    except dbus.DBusException as exc:
        raise CommandExecutionError(
            'Error encountered while retrieving snapshot: {0}'
            .format(_dbus_exception_to_reason(exc, locals()))
        )
1096335
def _get_snapshot(self):
        """"""
        if self._snapshot is None:
            self._snapshot = self._get_session().snapshot(
                read_timestamp=self._read_timestamp,
                exact_staleness=self._exact_staleness,
                multi_use=True,
            )
            self._snapshot.begin()
        return self._snapshot
412434
@Override
	public void snapshotState(StateSnapshotContext context) throws Exception {
		super.snapshotState(context);

		checkState(checkpointedState != null,
			"The operator state has not been properly initialized.");

		int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask();

		checkpointedState.clear();

		List<TimestampedFileInputSplit> readerState = reader.getReaderState();

		try {
			for (TimestampedFileInputSplit split : readerState) {
				// create a new partition for each entry.
				checkpointedState.add(split);
			}
		} catch (Exception e) {
			checkpointedState.clear();

			throw new Exception("Could not add timestamped file input splits to to operator " +
				"state backend of operator " + getOperatorName() + '.', e);
		}

		if (LOG.isDebugEnabled()) {
			LOG.debug("{} (taskIdx={}) checkpointed {} splits: {}.",
				getClass().getSimpleName(), subtaskIdx, readerState.size(), readerState);
		}
	}
513712
private void snapshotConfig() {
    synchronized (configManager) {
      maximum = configManager.getPoolMaximum(poolInfo, getType());
      minimum = configManager.getPoolMinimum(poolInfo, getType());
      weight = configManager.getWeight(poolInfo);
      priority = configManager.getPriority(poolInfo);
      preemptable = configManager.isPoolPreemptable(poolInfo);
      shareStarvingRatio = configManager.getShareStarvingRatio();
      minPreemptPeriod = configManager.getMinPreemptPeriod();
      starvingTimeForShare = configManager.getStarvingTimeForShare();
      starvingTimeForMinimum = configManager.getStarvingTimeForMinimum();
    }
  }
60647
public CompletableFuture<Void> snapshot() {
    return Futures.allOf(config.getMembers().stream()
        .map(MemberId::from)
        .map(id -> communicationService.send(snapshotSubject, null, id, SNAPSHOT_TIMEOUT))
        .collect(Collectors.toList()))
        .thenApply(v -> null);
  }
847972
public function takeSnapshot()
    {
        $this->enabledTypeBefore = null;

        if ($this->typeDescriptors->contains($this->typeName)) {
            foreach ($this->typeDescriptors->listByTypeName($this->typeName) as $typeDescriptor) {
                if ($typeDescriptor->isEnabled()) {
                    $this->enabledTypeBefore = $typeDescriptor;
                }
            }
        }

        $this->snapshotTaken = true;
    }
2257
protected final boolean exec() {
        Object backup = replay(captured);
        try {
            result = compute();
            return true;
        } finally {
            restore(backup);
        }
    }