File tree 5 files changed +17
-35
lines changed
Microsoft.Spark.Worker.UnitTest
5 files changed +17
-35
lines changed Original file line number Diff line number Diff line change 7
7
<inceptionYear >2019</inceptionYear >
8
8
<properties >
9
9
<encoding >UTF-8</encoding >
10
- <scala .version>2.11.8 </scala .version>
10
+ <scala .version>2.11.12 </scala .version>
11
11
<scala .binary.version>2.11</scala .binary.version>
12
12
<spark .version>2.4.4</spark .version>
13
13
</properties >
14
14
15
- <pluginRepositories >
16
- <pluginRepository >
17
- <id >scala</id >
18
- <name >Scala Tools</name >
19
- <url >http://scala-tools.org/repo-releases/</url >
20
- <releases >
21
- <enabled >true</enabled >
22
- </releases >
23
- <snapshots >
24
- <enabled >false</enabled >
25
- </snapshots >
26
- </pluginRepository >
27
- </pluginRepositories >
28
-
29
15
<dependencies >
30
16
<dependency >
31
17
<groupId >org.scala-lang</groupId >
Original file line number Diff line number Diff line change @@ -25,22 +25,23 @@ public DaemonWorkerTests()
25
25
26
26
[ Theory ]
27
27
[ MemberData ( nameof ( TestData . VersionData ) , MemberType = typeof ( TestData ) ) ]
28
- public void TestsDaemonWorkerTaskRunners ( string version )
28
+ public async void TestsDaemonWorkerTaskRunners ( string version )
29
29
{
30
30
ISocketWrapper daemonSocket = SocketFactory . CreateSocket ( ) ;
31
-
31
+
32
32
int taskRunnerNumber = 2 ;
33
33
var typedVersion = new Version ( version ) ;
34
34
var daemonWorker = new DaemonWorker ( typedVersion ) ;
35
-
36
- Task . Run ( ( ) => daemonWorker . Run ( daemonSocket ) ) ;
35
+
36
+ var _dummyTask = Task . Run ( ( ) => daemonWorker . Run ( daemonSocket ) ) ;
37
+ await daemonWorker . WaitForListenerReadyAsync ( ) ;
37
38
38
39
var clientSockets = new List < ISocketWrapper > ( ) ;
39
40
for ( int i = 0 ; i < taskRunnerNumber ; ++ i )
40
41
{
41
42
CreateAndVerifyConnection ( daemonSocket , clientSockets , typedVersion ) ;
42
43
}
43
-
44
+
44
45
Assert . Equal ( taskRunnerNumber , daemonWorker . CurrentNumTaskRunners ) ;
45
46
}
46
47
Original file line number Diff line number Diff line change 9
9
using System . Linq ;
10
10
using System . Net ;
11
11
using System . Threading ;
12
+ using System . Threading . Tasks ;
12
13
using Microsoft . Spark . Interop . Ipc ;
13
14
using Microsoft . Spark . Network ;
14
15
using Microsoft . Spark . Services ;
@@ -46,6 +47,8 @@ internal sealed class DaemonWorker
46
47
47
48
private readonly Version _version ;
48
49
50
+ private readonly TaskCompletionSource < bool > _listenerReadyTcs = new TaskCompletionSource < bool > ( ) ;
51
+
49
52
internal DaemonWorker ( Version version )
50
53
{
51
54
_version = version ;
@@ -73,6 +76,7 @@ internal void Run(ISocketWrapper listener)
73
76
try
74
77
{
75
78
listener . Listen ( ) ;
79
+ _listenerReadyTcs . TrySetResult ( true ) ;
76
80
77
81
// Communicate the server port back to the Spark using standard output.
78
82
Stream outputStream = Console . OpenStandardOutput ( ) ;
@@ -100,6 +104,11 @@ internal void Run(ISocketWrapper listener)
100
104
}
101
105
}
102
106
107
+ internal Task WaitForListenerReadyAsync ( )
108
+ {
109
+ return _listenerReadyTcs . Task ;
110
+ }
111
+
103
112
/// <summary>
104
113
/// Starts listening to any connection from JVM.
105
114
/// </summary>
Original file line number Diff line number Diff line change 10
10
<inceptionYear >2019</inceptionYear >
11
11
<properties >
12
12
<encoding >UTF-8</encoding >
13
- <scala .version>2.11.8 </scala .version>
13
+ <scala .version>2.11.12 </scala .version>
14
14
<scala .binary.version>2.11</scala .binary.version>
15
15
<spark .version>2.4.4</spark .version>
16
16
</properties >
Original file line number Diff line number Diff line change 18
18
<module >microsoft-spark-3-3</module >
19
19
<module >microsoft-spark-3-5</module >
20
20
</modules >
21
-
22
- <pluginRepositories >
23
- <pluginRepository >
24
- <id >scala</id >
25
- <name >Scala Tools</name >
26
- <url >http://scala-tools.org/repo-releases/</url >
27
- <releases >
28
- <enabled >true</enabled >
29
- </releases >
30
- <snapshots >
31
- <enabled >false</enabled >
32
- </snapshots >
33
- </pluginRepository >
34
- </pluginRepositories >
35
21
</project >
You can’t perform that action at this time.
0 commit comments