Navigation
API > API/Editor > API/Editor/UnrealEd
Director for managing worker processes from the main gather commandlet.
This is separate from UGatherTextFromAssetsCommandlet as UGatherTextFromAssetsCommandlet may be invoked multiple times within a single gather. Example usage: StartWorkers(...); WaitForWorkersToStart(); AssignPackageToWorker(...); while (!IsIdle()) { TickWorkers(); // Process GT messages and detect crashed/hung workers
while (TOptional<...> Result = IngestPackageResult()) { // Merge worker result into main result set }
... = IngestPackagesFromCrashedWorkers(); // Merge back into main job queue } StopWorkers();
Alternatively you may skip the blocking wait, and use GetAvailableWorkerIds to lazily assign jobs to the workers once available: StartWorkers(...); for (;;) { TickWorkers(); // Process GT messages and detect crashed/hung workers
if (... = GetAvailableWorkerIds(0)) { AssignPackageToWorker(...); }
while (TOptional<...> Result = IngestPackageResult()) { // Merge worker result into main result set }
... = IngestPackagesFromCrashedWorkers(); // Merge back into main job queue
if (IsIdle()) { break; } } StopWorkers();
| Name | FGatherTextFromAssetsWorkerDirector |
| Type | class |
| Header File | /Engine/Source/Editor/UnrealEd/Classes/Commandlets/GatherTextFromAssetsCommandlet.h |
| Include Path | #include "Commandlets/GatherTextFromAssetsCommandlet.h" |
Syntax
class FGatherTextFromAssetsWorkerDirector
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FGatherTextFromAssetsWorkerDirector() |
Commandlets/GatherTextFromAssetsCommandlet.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FGatherTextFromAssetsWorkerDirector() |
Commandlets/GatherTextFromAssetsCommandlet.h |
Structs
| Name | Remarks |
|---|---|
| FWorkerInfo | Information about the current worker processes, including the work that has been assigned to them |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bWorkersCanReadAssetRegistryCache | bool | Are workers allowed to read the asset registry cache? | Commandlets/GatherTextFromAssetsCommandlet.h | |
| CurrentWorkers | TMap< FGuid, TSharedPtr< FWorkerInfo > > | Commandlets/GatherTextFromAssetsCommandlet.h | ||
| CurrentWorkersMutex | UE::FMutex | Commandlets/GatherTextFromAssetsCommandlet.h | ||
| LastPingBroadcastUtc | FDateTime | The last time that we broadcast a ping message | Commandlets/GatherTextFromAssetsCommandlet.h | |
| MessageEndpoint | TSharedPtr< FMessageEndpoint > | Holds the messaging endpoint we are sending from | Commandlets/GatherTextFromAssetsCommandlet.h | |
| PackageResultHandler | TFunction< bool(const FGatherTextFromAssetsWorkerMessage_PackageResult &)> | Optional handler that will attempt to process results immediately, rather than add them to PackageResults | Commandlets/GatherTextFromAssetsCommandlet.h | |
| PackageResults | TMpscQueue< FGatherTextFromAssetsWorkerMessage_PackageResult > | The queue of results received from any worker | Commandlets/GatherTextFromAssetsCommandlet.h | |
| PackagesFromCrashedWorkers | TArray< FName > | The queue of packages that failed to be processed due to their worker crashing | Commandlets/GatherTextFromAssetsCommandlet.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool AssignPackageToWorker
(
const FGuid& WorkerId, |
Assign the given package to the given worker. | Commandlets/GatherTextFromAssetsCommandlet.h | |
void ClearIngestPackageResultHandler () |
Clear any currently set handler ( | Commandlets/GatherTextFromAssetsCommandlet.h | |
| Get the IDs of the available workers (that are ready to accept work), optionally only returning workers currently meet the given idle threshold (have <= IdleThreshold packages assigned). | Commandlets/GatherTextFromAssetsCommandlet.h | ||
bool HasWorkers () |
Does this director have workers? | Commandlets/GatherTextFromAssetsCommandlet.h | |
TOptional< FGatherTextFromAssetsWorkerMessage_PackageResult > IngestPackageResult() |
Ingest the next package result received from any worker, if any. | Commandlets/GatherTextFromAssetsCommandlet.h | |
| Ingest the current queue of packages that failed to be processed due to their worker crashing. | Commandlets/GatherTextFromAssetsCommandlet.h | ||
bool IsIdle
(
int32* OutNumPendingWorkerPackages |
Is this director idle? | Commandlets/GatherTextFromAssetsCommandlet.h | |
void SetIngestPackageResultHandler
(
TFunction< bool(const FGatherTextFromAssetsWorkerMessage_PackageResult&)>&& Handler |
Set the handler used to automatically ingest package results as they arrive (from any thread), rather than add them to PackageResults for deferred processing via IngestPackageResult. | Commandlets/GatherTextFromAssetsCommandlet.h | |
void SetWorkersCanReadAssetRegistryCache
(
const bool bValue |
Set whether or not worker processes are allowed to read the asset registry cache. | Commandlets/GatherTextFromAssetsCommandlet.h | |
bool StartWorkers
(
const int32 NumWorkers, |
Start the given number of worker processes. | Commandlets/GatherTextFromAssetsCommandlet.h | |
bool StopWorkers() |
Stop the current workers (if any), discarding any work that may currently be assigned to them. | Commandlets/GatherTextFromAssetsCommandlet.h | |
void TickWorkers() |
Tick workers, to detect which have crashed or hung. | Commandlets/GatherTextFromAssetsCommandlet.h | |
| Block while any workers created by StartWorkers are in state where they can accept work. | Commandlets/GatherTextFromAssetsCommandlet.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FGatherTextFromAssetsWorkerDirector & Get() |
Get the singleton director instance. | Commandlets/GatherTextFromAssetsCommandlet.h |