Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give parallelisation a go #1002

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b7ff5b5
Messy parallellisation
samdanae Sep 19, 2024
d68cbd8
Wait indefinitely to clean up workspace
samdanae Sep 19, 2024
4f6a2fb
Revert "Wait indefinitely to clean up workspace"
samdanae Sep 19, 2024
ecac9b4
Revert "Messy parallellisation"
samdanae Sep 19, 2024
6012fb6
Add some logging
samdanae Sep 19, 2024
bc5dc28
Further logging
samdanae Sep 19, 2024
69c6ed7
Add more logging
samdanae Sep 19, 2024
48dc858
Log out dispose
samdanae Sep 19, 2024
51fd41a
Set timeout of dispose cancellation token to 100 seconds
samdanae Sep 19, 2024
3e71b30
Logging RunCommandOutOfProcess
samdanae Sep 20, 2024
f8be7e5
Little bit more logging on exit code
samdanae Sep 20, 2024
0584e5a
Add logging into tentacle stop process
samdanaei Sep 20, 2024
995979e
Try not disposing and see if at least that test passes
samdanae Sep 20, 2024
d10281b
Introduce logging of deletion
samdanae Sep 20, 2024
54fd2c8
Taking out a few using statements to test theory
samdanae Sep 20, 2024
3624a78
Add back onto one test
samdanae Sep 20, 2024
eb2a674
And more logging - around the disposal call
samdanae Sep 20, 2024
83e436a
log deleteInstanceFunction after it has finished
samdanaei Sep 21, 2024
336a073
Log start() methods
samdanaei Sep 21, 2024
a4e4145
Put back some using statements
samdanaei Sep 21, 2024
a7ba083
Log out all arguments of the tentacle calls
samdanaei Sep 22, 2024
8064978
await the async call
samdanaei Sep 22, 2024
f9bb94c
Separate dispose calls - await each call
samdanaei Sep 22, 2024
93cd0d1
Swap, to make sure that tentacle dispose is the last thing that happe…
samdanaei Sep 22, 2024
1c6bfbf
Comment out RunningTentacle.DisposeAsync during client and tentacle d…
samdanaei Sep 22, 2024
cb73f5d
Await and log
samdanaei Sep 23, 2024
c702502
Remove all await using statements from TentacleCommandLineTests.cs
samdanaei Sep 23, 2024
7c65879
Remove all using statements from previously failing tests
samdanaei Sep 23, 2024
032dae9
Remove more using statements
samdanaei Sep 23, 2024
5307984
A few more removals
samdanaei Sep 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task CapabilitiesFromAnOlderTentacleWhichHasNoCapabilitiesService_W
{
Version? version = tentacleConfigurationTestCase.Version;

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateLegacyBuilder().Build(CancellationToken);
var clientAndTentacle = await tentacleConfigurationTestCase.CreateLegacyBuilder().Build(CancellationToken);

var capabilities = (await clientAndTentacle.TentacleClient.CapabilitiesServiceV2.GetCapabilitiesAsync(new(CancellationToken))).SupportedCapabilities;

Expand All @@ -48,7 +48,7 @@ public async Task CapabilitiesServiceDoesNotReturnKubernetesScriptServiceForNonK
{
var version = tentacleConfigurationTestCase.Version;

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateLegacyBuilder().Build(CancellationToken);
var clientAndTentacle = await tentacleConfigurationTestCase.CreateLegacyBuilder().Build(CancellationToken);

var capabilities = (await clientAndTentacle.TentacleClient.CapabilitiesServiceV2.GetCapabilitiesAsync(new(CancellationToken))).SupportedCapabilities;

Expand All @@ -75,7 +75,7 @@ public async Task CapabilitiesResponseShouldBeCached(TentacleConfigurationTestCa
var capabilitiesResponses = new List<CapabilitiesResponseV2>();
var resumePortForwarder = false;

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPortForwarder(out var portForwarder)
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder()
.DecorateCapabilitiesServiceV2With(d => d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ClientFileTransferRetriesTimeout : IntegrationTest
public async Task WhenRpcRetriesTimeOut_DuringUploadFile_TheRpcCallIsCancelled(TentacleConfigurationTestCase tentacleConfigurationTestCase, bool stopPortForwarderAfterFirstCall)
{
PortForwarder portForwarder = null!;
await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
// Set a short retry duration so we cancel fairly quickly
.WithRetryDuration(TimeSpan.FromSeconds(15))
.WithPortForwarderDataLogging()
Expand Down Expand Up @@ -103,7 +103,7 @@ public async Task WhenUploadFileFails_AndTakesLongerThanTheRetryDuration_TheCall
{
var retryDuration = TimeSpan.FromSeconds(15);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
// Set a short retry duration so we cancel fairly quickly
.WithRetryDuration(retryDuration)
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
Expand Down Expand Up @@ -145,7 +145,7 @@ public async Task WhenUploadFileFails_AndTakesLongerThanTheRetryDuration_TheCall
public async Task WhenRpcRetriesTimeOut_DuringDownloadFile_TheRpcCallIsCancelled(TentacleConfigurationTestCase tentacleConfigurationTestCase, bool stopPortForwarderAfterFirstCall)
{
PortForwarder portForwarder = null!;
await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
// Set a short retry duration so we cancel fairly quickly
.WithRetryDuration(TimeSpan.FromSeconds(15))
.WithPortForwarderDataLogging()
Expand Down Expand Up @@ -215,7 +215,7 @@ public async Task WhenDownloadFileFails_AndTakesLongerThanTheRetryDuration_TheCa
{
var retryDuration = TimeSpan.FromSeconds(15);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
// Set a short retry duration so we cancel fairly quickly
.WithRetryDuration(retryDuration)
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ClientFileTransfersAreNotRetriedWhenRetriesAreDisabled : Integratio
[TentacleConfigurations(testCommonVersions: true, scriptServiceToTest: ScriptServiceVersionToTest.None)]
public async Task FailedUploadsAreNotRetriedAndFail(TentacleConfigurationTestCase tentacleConfigurationTestCase)
{
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithRetriesDisabled()
.WithPortForwarderDataLogging()
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
Expand Down Expand Up @@ -58,7 +58,7 @@ public async Task FailedUploadsAreNotRetriedAndFail(TentacleConfigurationTestCas
[TentacleConfigurations(testCommonVersions: true, scriptServiceToTest: ScriptServiceVersionToTest.None)]
public async Task FailedDownloadsAreNotRetriedAndFail(TentacleConfigurationTestCase tentacleConfigurationTestCase)
{
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithRetriesDisabled()
.WithPortForwarderDataLogging()
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ClientFileTransfersAreRetriedWhenRetriesAreEnabled : IntegrationTes
[TentacleConfigurations(testCommonVersions: true, scriptServiceToTest: ScriptServiceVersionToTest.None)]
public async Task FailedUploadsAreRetriedAndIsEventuallySuccessful(TentacleConfigurationTestCase tentacleConfigurationTestCase)
{
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPortForwarderDataLogging()
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
.WithTcpConnectionUtilities(Logger, out var tcpConnectionUtilities)
Expand Down Expand Up @@ -65,7 +65,7 @@ public async Task FailedUploadsAreRetriedAndIsEventuallySuccessful(TentacleConfi
[TentacleConfigurations(testCommonVersions: true, scriptServiceToTest: ScriptServiceVersionToTest.None)]
public async Task FailedDownloadsAreRetriedAndIsEventuallySuccessful(TentacleConfigurationTestCase tentacleConfigurationTestCase)
{
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPortForwarderDataLogging()
.WithResponseMessageTcpKiller(out var responseMessageTcpKiller)
.WithTcpConnectionUtilities(Logger, out var tcpConnectionUtilities)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task ExecuteScriptShouldGatherMetrics_WhenSucceeds(TentacleConfigur
{
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.Build(CancellationToken);

Expand Down Expand Up @@ -62,7 +62,7 @@ public async Task ExecuteScriptShouldGatherMetrics_WhenFails(TentacleConfigurati
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
var exception = new HalibutClientException("Error");
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.WithRetryDuration(TimeSpan.FromSeconds(1))
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder()
Expand Down Expand Up @@ -94,7 +94,7 @@ public async Task UploadFileShouldGatherMetrics_WhenSucceeds(TentacleConfigurati
{
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.Build(CancellationToken);

Expand All @@ -121,7 +121,7 @@ public async Task UploadFileShouldGatherMetrics_WhenFails(TentacleConfigurationT
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
var exception = new HalibutClientException("Error");
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.WithRetryDuration(TimeSpan.FromSeconds(1))
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder()
Expand Down Expand Up @@ -151,7 +151,7 @@ public async Task DownloadFileShouldGatherMetrics_WhenSucceeds(TentacleConfigura
{
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.Build(CancellationToken);

Expand Down Expand Up @@ -179,7 +179,7 @@ public async Task DownloadFileShouldGatherMetrics_WhenFails(TentacleConfiguratio
// Arrange
var tentacleClientObserver = new TestTentacleClientObserver();
var exception = new HalibutClientException("Error");
await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithTentacleClientObserver(tentacleClientObserver)
.WithRetryDuration(TimeSpan.FromSeconds(1))
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task AdditionalScriptsWork(TentacleConfigurationTestCase tentacleCo
using var tmp = new TemporaryDirectory();
var path = Path.Combine(tmp.DirectoryPath, "file");

await using var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.Build(CancellationToken);

var scriptBuilder = new ScriptBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task DuringGetCapabilities_ScriptExecutionCanBeCancelled(TentacleCo
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point => point.TryAndConnectForALongTime())
.WithRetriesDisabled()
Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task DuringStartScript_ScriptExecutionCanBeCancelled(TentacleConfig
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point => point.TryAndConnectForALongTime())
.WithRetriesDisabled()
Expand Down Expand Up @@ -208,7 +208,7 @@ public async Task DuringGetStatus_ScriptExecutionCanBeCancelled(TentacleConfigur
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point => point.TryAndConnectForALongTime())
.WithRetriesDisabled()
Expand Down Expand Up @@ -292,7 +292,7 @@ public async Task DuringCompleteScript_ScriptExecutionCanBeCancelled(TentacleCon
var rpcCallHasStarted = new Reference<bool>(false);
var hasPausedOrStoppedPortForwarder = false;

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point => point.TryAndConnectForALongTime())
.WithRetriesDisabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task DuringGetCapabilities_ScriptExecutionCanBeCancelled(TentacleCo
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point =>
{
Expand Down Expand Up @@ -142,7 +142,7 @@ public async Task DuringStartScript_ScriptExecutionCanBeCancelled(TentacleConfig
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point =>
{
Expand Down Expand Up @@ -274,7 +274,7 @@ public async Task DuringStartScript_ForPollingTentacle_ThatIsRetryingTheRpc_AndC
var started = false;
var cancelExecutionCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(CancellationToken);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithRetryDuration(TimeSpan.FromHours(1))
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder().RecordMethodUsages(tentacleConfigurationTestCase, out var scriptServiceRecordedUsages).Build())
.WithPendingRequestQueueFactory(new CancelWhenRequestQueuedPendingRequestQueueFactory(
Expand Down Expand Up @@ -342,7 +342,7 @@ public async Task DuringStartScript_ForListeningTentacle_ThatIsRetryingTheRpc_An

var cancelExecutionCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(CancellationToken);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithRetryDuration(TimeSpan.FromHours(1))
.WithTentacleServiceDecorator(new TentacleServiceDecoratorBuilder().RecordMethodUsages(tentacleConfigurationTestCase, out var scriptServiceRecordedUsages).Build())
.WithHalibutTimeoutsAndLimits(halibutTimeoutsAndLimits)
Expand Down Expand Up @@ -409,7 +409,7 @@ public async Task DuringGetStatus_ScriptExecutionCanBeCancelled(TentacleConfigur
var hasPausedOrStoppedPortForwarder = false;
var ensureCancellationOccursDuringAnRpcCall = new SemaphoreSlim(0, 1);

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithServiceEndpointModifier(point =>
{
Expand Down Expand Up @@ -520,7 +520,7 @@ public async Task DuringCompleteScript_ScriptExecutionCanBeCancelled(TentacleCon
var rpcCallHasStarted = new Reference<bool>(false);
var hasPausedOrStoppedPortForwarder = false;

await using var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
var clientAndTentacle = await tentacleConfigurationTestCase.CreateBuilder()
.WithPendingRequestQueueFactory(new CancellationObservingPendingRequestQueueFactory()) // Partially works around disconnected polling tentacles take work from the queue
.WithRetryDuration(TimeSpan.FromHours(1))
.WithPortForwarderDataLogging()
Expand Down
Loading