|
|
|
|
|
|
sysParamMenu.text = definition.description; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
sysParamMenu.text = sysParamDefinitions[0].description; |
|
|
|
m_SysParam = sysParamDefinitions[0]; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
EditorUtility.ClearProgressBar(); |
|
|
|
PerceptionEditorAnalytics.ReportRunInUnitySimulationFailed(runGuid, e.Message); |
|
|
|
throw; |
|
|
|
} |
|
|
|
|
|
|
Debug.Log("Created build zip"); |
|
|
|
} |
|
|
|
|
|
|
|
List<AppParam> GenerateAppParamIds(CancellationToken token) |
|
|
|
List<AppParam> GenerateAppParamIds(CancellationToken token, float progressStart, float progressEnd) |
|
|
|
{ |
|
|
|
var appParamIds = new List<AppParam>(); |
|
|
|
var scenario = (ScenarioBase)m_ScenarioField.value; |
|
|
|
|
|
|
constants["totalIterations"] = m_TotalIterationsField.value; |
|
|
|
constants["instanceCount"]= m_InstanceCountField.value; |
|
|
|
constants["instanceCount"] = m_InstanceCountField.value; |
|
|
|
|
|
|
|
var progressIncrement = (progressEnd - progressStart) / m_InstanceCountField.value; |
|
|
|
|
|
|
|
for (var i = 0; i < m_InstanceCountField.value; i++) |
|
|
|
{ |
|
|
|
|
|
|
constants["instanceIndex"]= i; |
|
|
|
constants["instanceIndex"] = i; |
|
|
|
|
|
|
|
var appParamsString = JsonConvert.SerializeObject(configuration, Formatting.Indented); |
|
|
|
var appParamId = API.UploadAppParam(appParamName, appParamsString); |
|
|
|
|
|
|
name = appParamName, |
|
|
|
num_instances = 1 |
|
|
|
}); |
|
|
|
|
|
|
|
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Uploading app-param-ids for instances: {i + 1}/{m_InstanceCountField.value}", progressStart + progressIncrement * i); |
|
|
|
} |
|
|
|
|
|
|
|
return appParamIds; |
|
|
|
|
|
|
{ |
|
|
|
EditorUtility.DisplayProgressBar("Unity Simulation Run", "Uploading build...", 0.1f); |
|
|
|
|
|
|
|
m_RunButton.SetEnabled(false); |
|
|
|
var cancellationTokenSource = new CancellationTokenSource(); |
|
|
|
var token = cancellationTokenSource.Token; |
|
|
|
|
|
|
cancellationTokenSource: cancellationTokenSource); |
|
|
|
Debug.Log($"Build upload complete: build id {buildId}"); |
|
|
|
|
|
|
|
var appParams = GenerateAppParamIds(token); |
|
|
|
var appParams = GenerateAppParamIds(token, 0.1f, 0.9f); |
|
|
|
EditorUtility.ClearProgressBar(); |
|
|
|
|
|
|
|
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Uploading run definition...", 0.9f); |
|
|
|
|
|
|
|
var runDefinitionId = API.UploadRunDefinition(new RunDefinition |
|
|
|
{ |
|
|
|
app_params = appParams.ToArray(), |
|
|
|
|
|
|
}); |
|
|
|
Debug.Log($"Run definition upload complete: run definition id {runDefinitionId}"); |
|
|
|
|
|
|
|
EditorUtility.DisplayProgressBar("Unity Simulation Run", $"Executing run...", 0.95f); |
|
|
|
|
|
|
|
|
|
|
|
EditorUtility.ClearProgressBar(); |
|
|
|
|
|
|
|
PerceptionEditorAnalytics.ReportRunInUnitySimulationSucceeded(runGuid, run.executionId); |
|
|
|
} |