diff options
| author | Martin Ridgers <[email protected]> | 2021-11-22 09:13:27 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-11-22 09:13:27 +0100 |
| commit | be52dec8e8c1c5d3901d9f6d742c626931abff27 (patch) | |
| tree | a832df6ed494ea770fec3ee57a258d3cc9384a13 /zenserver/upstream/upstreamapply.cpp | |
| parent | Initial integration of Trace from UE5 via the --zentrace=y xmake config (diff) | |
| parent | Comment out unused variables to fix warnings. (diff) | |
| download | zen-be52dec8e8c1c5d3901d9f6d742c626931abff27.tar.xz zen-be52dec8e8c1c5d3901d9f6d742c626931abff27.zip | |
Merged main
Diffstat (limited to 'zenserver/upstream/upstreamapply.cpp')
| -rw-r--r-- | zenserver/upstream/upstreamapply.cpp | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/zenserver/upstream/upstreamapply.cpp b/zenserver/upstream/upstreamapply.cpp index a0c6a91cf..b96adef2a 100644 --- a/zenserver/upstream/upstreamapply.cpp +++ b/zenserver/upstream/upstreamapply.cpp @@ -801,9 +801,42 @@ namespace detail { { using namespace fmt::literals; std::string_view HostPlatform = ApplyRecord.WorkerDescriptor["host"sv].AsString(); - // TODO: Enable when Horde accepts the UE style Host Platforms (Win64, Linux, Mac) - // CbObject Requirements = BuildRequirements("OSFamily == '{}'"_format(HostPlatform), {}, false); - CbObject Requirements = BuildRequirements("OSFamily == 'Windows'", {}, false); + if (HostPlatform.empty()) + { + Log().warn("process apply upstream FAILED, 'host' platform not provided"); + return false; + } + + int32_t LogicalCores = ApplyRecord.WorkerDescriptor["cores"sv].AsInt32(); + int64_t Memory = ApplyRecord.WorkerDescriptor["memory"sv].AsInt64(); + bool Exclusive = ApplyRecord.WorkerDescriptor["exclusive"sv].AsBool(); + + // TODO: Remove override when Horde accepts the UE style Host Platforms (Win64, Linux, Mac) + std::string Condition; + if (HostPlatform == "Win64" || HostPlatform == "Windows") + { + Condition = "OSFamily == 'Windows' && Pool == 'Win-RemoteExec'"; + } + else if (HostPlatform == "Mac") + { + Condition = "OSFamily == 'MacOS'"; + } + else + { + Condition = "OSFamily == '{}'"_format(HostPlatform); + } + + std::map<std::string_view, int64_t> Resources; + if (LogicalCores > 0) + { + Resources["LogicalCores"sv] = LogicalCores; + } + if (Memory > 0) + { + Resources["RAM"sv] = std::max(Memory / 1024 / 1024 / 1024, 1LL); + } + + CbObject Requirements = BuildRequirements(Condition, Resources, Exclusive); const IoHash RequirementsId = Requirements.GetHash(); Data.Objects[RequirementsId] = std::move(Requirements); Data.RequirementsId = RequirementsId; @@ -957,7 +990,7 @@ namespace detail { } [[nodiscard]] CbObject BuildRequirements(const std::string_view Condition, - const std::map<std::string_view, int32_t>& Resources, + const std::map<std::string_view, int64_t>& Resources, const bool Exclusive) { CbObjectWriter Writer; @@ -1110,11 +1143,11 @@ struct UpstreamApplyStats UpstreamApplyEndpointStats& Stats = Ep->Stats(); const uint64_t PostCount = Stats.PostCount; const uint64_t CompleteCount = Stats.CompleteCount; - const uint64_t UpdateCount = Stats.UpdateCount; - const double DownBytes = Stats.DownBytes; - const double SecondsDown = Stats.SecondsDown; - const double UpBytes = Stats.UpBytes; - const double SecondsUp = Stats.SecondsUp; + // const uint64_t UpdateCount = Stats.UpdateCount; + const double DownBytes = Stats.DownBytes; + const double SecondsDown = Stats.SecondsDown; + const double UpBytes = Stats.UpBytes; + const double SecondsUp = Stats.SecondsUp; const double UpSpeed = UpBytes > 0 ? UpBytes / SecondsUp : 0.0; const double DownSpeed = DownBytes > 0 ? DownBytes / SecondsDown : 0.0; @@ -1254,8 +1287,8 @@ public: UpstreamApplyEndpointStats& Stats = Ep->Stats(); const uint64_t PostCount = Stats.PostCount; const uint64_t CompleteCount = Stats.CompleteCount; - const uint64_t UpdateCount = Stats.UpdateCount; - const double CompleteRate = CompleteCount > 0 ? (double(PostCount) / double(CompleteCount)) : 0.0; + // const uint64_t UpdateCount = Stats.UpdateCount; + const double CompleteRate = CompleteCount > 0 ? (double(PostCount) / double(CompleteCount)) : 0.0; Status << "post_count" << PostCount; Status << "complete_count" << PostCount; |