Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1e5c487
integrate multi-machine testing code
zain-mecklai May 4, 2022
d3f2a1a
Reconfigure how host/client ip/port is set
zain-mecklai May 4, 2022
017e2ec
PR feedback
zain-mecklai May 4, 2022
4e649b0
Undetected compilation error
zain-mecklai May 4, 2022
0d8ff21
update to use async await
zain-mecklai May 4, 2022
698420c
use async await
zain-mecklai May 4, 2022
4370869
Use async/await and avoid call to Wait()
zain-mecklai May 5, 2022
9b7bda6
Clean up whitespace as well as remove calls to Wait()
zain-mecklai May 5, 2022
5eb6c6f
only whitespace
zain-mecklai May 5, 2022
c2db7bf
attempt to move setting up StartClient to support async config
zain-mecklai May 11, 2022
6c28094
Continued experiments
zain-mecklai May 11, 2022
5b74d53
Start client after the configuration has been set
zain-mecklai May 11, 2022
3f56741
Use notifications and callbacks instead of waits to enable TestCoordi…
zain-mecklai May 24, 2022
dfd9055
Make startclient call explicit
zain-mecklai May 24, 2022
16f3199
Test Coordinator cleanup for INotifyPropertyChanged
zain-mecklai May 24, 2022
9fd9aa5
Fix whitespace
zain-mecklai May 24, 2022
39e091c
Fix whitespace, simplify
zain-mecklai May 24, 2022
69a0c4c
Merge branch 'develop' into test/remote_config_support_for_multiproce…
zain-mecklai May 24, 2022
c644ef2
Merge branch 'develop' into test/remote_config_support_for_multiproce…
zain-mecklai May 25, 2022
239f39c
Merge branch 'develop' into test/remote_config_support_for_multiproce…
NoelStephensUnity May 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 24 additions & 35 deletions testproject/Assets/Scenes/MultiprocessTestScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657838, g: 0.49641234, b: 0.57481676, a: 1}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -212,7 +212,6 @@ Transform:
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
Expand All @@ -223,8 +222,8 @@ LightingSettings:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
serializedVersion: 4
m_Name:
serializedVersion: 3
m_GIWorkflowMode: 1
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
Expand All @@ -237,7 +236,7 @@ LightingSettings:
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_TextureCompression: 1
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
Expand Down Expand Up @@ -278,7 +277,6 @@ LightingSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0
--- !u!1 &160940364
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -371,7 +369,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -10, y: -10, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
Expand Down Expand Up @@ -405,10 +402,10 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 04cf3cc1396054b009a1ed283aa50021, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
IsTestCoordinatorActiveAndEnabled: 0
CommandLineArguments:
CommandLineArguments:
--- !u!102 &430011405
TextMesh:
serializedVersion: 3
Expand Down Expand Up @@ -481,9 +478,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 430011403}
m_LocalRotation: {x: 0.2164396, y: 0, z: 0, w: 0.97629607}
m_LocalPosition: {x: -40, y: 0, z: 10}
m_LocalPosition: {x: -45, y: 10, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
Expand Down Expand Up @@ -567,7 +563,6 @@ Transform:
m_LocalRotation: {x: 0.21736304, y: -0, z: -0, w: 0.97609085}
m_LocalPosition: {x: 0, y: 9.15, z: -27.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
Expand Down Expand Up @@ -664,7 +659,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
Expand Down Expand Up @@ -761,7 +755,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 10, y: 10, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
Expand Down Expand Up @@ -795,8 +788,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
RunInBackground: 1
LogLevel: 1
NetworkConfig:
Expand All @@ -814,7 +807,7 @@ MonoBehaviour:
TickRate: 30
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionData:
ConnectionData:
EnableTimeResync: 0
TimeResyncInterval: 30
EnsureNetworkVariableLengthSafety: 0
Expand All @@ -836,7 +829,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1674777072}
- {fileID: 2027640072}
Expand All @@ -853,8 +845,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 068bf11ceb1344667af4cc40950f44f4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
ReferencedPrefab: {fileID: 9115731988109684252, guid: c2851feb7276442cc86a6f2d1d69ea11,
type: 3}
--- !u!114 &1211923378
Expand All @@ -867,8 +859,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 55d1c75ce242745ac98f7e7aca6d2d19, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1274245423
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -897,8 +889,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
GlobalObjectIdHash: 2217825759
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
Expand All @@ -913,7 +905,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 10, y: 10, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
Expand All @@ -928,8 +919,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ef1240e0784f84eadb77fe822e2e03c7, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1674777071
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -957,7 +948,6 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1211923376}
m_RootOrder: 0
Expand All @@ -972,8 +962,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b84c2d8dfe509a34fb59e2b81f8e1319, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
MessageBufferSize: 50000
MaxConnections: 100
MaxSentMessageQueueSize: 50000
Expand Down Expand Up @@ -1008,7 +998,6 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1211923376}
m_RootOrder: 1
Expand All @@ -1023,8 +1012,8 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6960e84d07fb87f47956e7a81d71c4e6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Name:
m_EditorClassIdentifier:
m_ProtocolType: 0
m_MaxPacketQueueSize: 128
m_MaxPayloadSize: 4096
Expand All @@ -1036,7 +1025,7 @@ MonoBehaviour:
ConnectionData:
Address: 127.0.0.1
Port: 7777
ServerListenAddress:
ServerListenAddress:
DebugSimulator:
PacketDelayMS: 0
PacketJitterMS: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using Object = UnityEngine.Object;
using Unity.Netcode.Transports.UNET;
using Unity.Netcode.Transports.UTP;


namespace Unity.Netcode.MultiprocessRuntimeTests
{
Expand Down Expand Up @@ -77,6 +80,27 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
SceneManager.SetActiveScene(scene);
}

var transport = NetworkManager.Singleton.NetworkConfig.NetworkTransport;
MultiprocessLogger.Log($"transport is {transport}");
switch (transport)
{
case UNetTransport unetTransport:
unetTransport.ConnectPort = int.Parse(TestCoordinator.Port);
unetTransport.ServerListenPort = int.Parse(TestCoordinator.Port);
unetTransport.ConnectAddress = "127.0.0.1";
MultiprocessLogger.Log($"Setting ConnectAddress to {unetTransport.ConnectAddress} port {unetTransport.ConnectPort}, {unetTransport.ServerListenPort}");

break;
case UnityTransport unityTransport:
unityTransport.ConnectionData.ServerListenAddress = "0.0.0.0";
MultiprocessLogger.Log($"Setting unityTransport.ConnectionData.Port {unityTransport.ConnectionData.ServerListenAddress}");
break;
default:
MultiprocessLogger.LogError($"The transport {transport} has no case");
break;
}

MultiprocessLogger.Log("Starting Host");
NetworkManager.Singleton.StartHost();

// Use scene verification to make sure we don't try to get clients to synchronize the TestRunner scene
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
using UnityEngine;
using System;
using System.Net.Http;
using System.Threading;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Unity.Netcode.MultiprocessRuntimeTests
{
public class ConfigurationTools
{
public static async Task<JobQueueItemArray> GetRemoteConfig()
{
var theList = new JobQueueItemArray();
using var client = new HttpClient();
var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var response = await client.GetAsync("https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile",
HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false);
var content = await response.Content.ReadAsStringAsync();
JsonUtility.FromJsonOverwrite(content, theList);
return theList;
}

public static async void CompleteJobQueueItem(JobQueueItem item)
{
await PostJobQueueItem(item, "/complete");
}

public static async void ClaimJobQueueItem(JobQueueItem item)
{
await PostJobQueueItem(item, "/claim");
}

public static async Task PostJobQueueItem(JobQueueItem item, string path = "")
{
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://multiprocess-log-event-manager.cds.internal.unity3d.com/api/JobWithFile" + path);
var json = JsonUtility.ToJson(item);
using var stringContent = new StringContent(json, Encoding.UTF8, "application/json");
request.Content = stringContent;
MultiprocessLogger.Log($"Posting remoteConfig to server {json}");
var cancelAfterDelay = new CancellationTokenSource(TimeSpan.FromSeconds(20));
var response = await client
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancelAfterDelay.Token).ConfigureAwait(false);
MultiprocessLogger.Log($"remoteConfig posted, checking response {response.StatusCode}");
}
}

[Serializable]
public class JobQueueItemArray
{
public List<JobQueueItem> JobQueueItems;
}

[Serializable]
public class JobQueueItem
{
public int Id;
public long JobId;
public string GitHash;
public string HostIp;
public int PlatformId;
public int JobStateId;
public string CreatedBy;
public string UpdatedBy;
public string TransportName;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

public enum ConfigurationType
{
Unknown,
Remote,
CommandLine,
ResourceFile,
Host
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ public static void LogWarning(string msg)

public class MultiprocessLogHandler : ILogHandler
{
public static long JobId;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job ID will be helpful indeed! (just catching up to this PR)

static MultiprocessLogHandler()
{
if (JobId == 0)
{
string sJobId = Environment.GetEnvironmentVariable("YAMATO_JOB_ID");
if (!long.TryParse(sJobId, out JobId))
{
JobId = -2;
}
}
}
public void LogException(Exception exception, UnityEngine.Object context)
{
Debug.unityLogger.LogException(exception, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static string StartWorkerNode()
case RuntimePlatform.WindowsEditor:
workerProcess.StartInfo.FileName = $"{buildPath}.exe";
//extraArgs += "-popupwindow -screen-width 100 -screen-height 100";
extraArgs += "-batchmode -nographics";
extraArgs += "-popupwindow";
break;
case RuntimePlatform.LinuxPlayer:
case RuntimePlatform.LinuxEditor:
Expand Down
Loading