-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from betarixm/develop
Iteration 05
- Loading branch information
Showing
16 changed files
with
405 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Progress Report | ||
|
||
> 11/17/2023 - 11/23/2023 | ||
## Discussion | ||
|
||
### File Naming Convention | ||
|
||
> For `/[INPUT DIR]/[BLOCK A]` | ||
- Sorted Block A | ||
- `/[INPUT DIR]/[BLOCK A]` | ||
- A Partition of A | ||
- `/[INPUT DIR]/[BLOCK A].[FROM].[TO]` | ||
- Partition from Other Worker | ||
- `/[OUTPUT DIR]/[UUID]` | ||
- Merged | ||
- `/[OUTPUT DIR]/result` | ||
|
||
## Completed Tasks | ||
|
||
- Merge proto related branches and implement (#62) | ||
- Implement Worker Server (#63) | ||
- Implement Exchange Server (#64) | ||
- Implement Master Server (#65) | ||
- CLI and Initialize (#66) | ||
|
||
## Assigned Tasks | ||
|
||
- Refactor Servers and Clients (#75) | ||
- @betarixm | ||
- Extract Key Range from Worker (#76) | ||
- @leejiwon1125 | ||
- E2E Test (Small) (#77) | ||
- @betarixm, @hataehyeok, @leejiwon1125 | ||
- Exchange Server and Client (#78) | ||
- @leejiwon1125 | ||
- E2E Test (Real World) (#79) | ||
- @betarixm, @hataehyeok, @leejiwon1125 | ||
- Grpc Test (#80) | ||
- @hataehyeok | ||
- Logging (#81) | ||
- @betarixm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
package kr.ac.postech.paranode.master | ||
|
||
import kr.ac.postech.paranode.core.WorkerMetadata | ||
import kr.ac.postech.paranode.rpc.MasterServer | ||
|
||
import java.net._ | ||
import scala.util.Try | ||
|
||
object Main { | ||
def main(args: Array[String]): Unit = { | ||
println("Hello world!") | ||
val numberOfWorker = Try(args(0).toInt).getOrElse { | ||
println("Invalid command") | ||
return | ||
} | ||
|
||
val server = new MasterServer(scala.concurrent.ExecutionContext.global) | ||
server.startServer() | ||
|
||
while (server.getWorkerDetails.size < numberOfWorker) { | ||
Thread.sleep(1000) | ||
} | ||
|
||
val workerInfo: List[WorkerMetadata] = server.getWorkerDetails | ||
|
||
assert(workerInfo.size == numberOfWorker) | ||
|
||
try { | ||
val ipAddress = InetAddress.getLocalHost.getHostAddress | ||
|
||
println(ipAddress + ":" + server.getPort) | ||
println(workerInfo.map(_.host).mkString(", ")) | ||
} catch { | ||
case e: Exception => e.printStackTrace() | ||
} | ||
// TODO: save workerInfo and start WorkerClient | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
|
||
package kr.ac.postech.paranode.rpc; | ||
|
||
message Node { | ||
string host = 1; | ||
int32 port = 2; | ||
} | ||
|
||
message KeyRange { | ||
bytes from = 1; | ||
bytes to = 2; | ||
} | ||
|
||
message WorkerMetadata { | ||
Node node = 1; | ||
KeyRange keyRange = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,43 @@ | ||
package kr.ac.postech.paranode.rpc | ||
|
||
import com.google.protobuf.ByteString | ||
import io.grpc.ManagedChannel | ||
import io.grpc.ManagedChannelBuilder | ||
import kr.ac.postech.paranode.rpc.exchange.ExchangeGrpc | ||
import kr.ac.postech.paranode.rpc.exchange.ExchangeGrpc.ExchangeBlockingStub | ||
import kr.ac.postech.paranode.rpc.exchange.GetMyRecordsReply | ||
import kr.ac.postech.paranode.rpc.exchange.GetMyRecordsRequest | ||
import kr.ac.postech.paranode.core.Record | ||
|
||
import java.util.concurrent.TimeUnit | ||
import java.util.logging.Logger | ||
|
||
import exchange.ExchangeGrpc.ExchangeBlockingStub | ||
import exchange.{ExchangeGrpc, SaveRecordsReply, SaveRecordsRequest} | ||
|
||
object ExchangeClient { | ||
def apply(host: String, port: Int): ExchangeClient = { | ||
val channel = ManagedChannelBuilder | ||
.forAddress(host, port) | ||
.usePlaintext() | ||
.build | ||
.build() | ||
|
||
val blockingStub = ExchangeGrpc.blockingStub(channel) | ||
new ExchangeClient(channel, blockingStub) | ||
} | ||
|
||
def main(args: Array[String]): Unit = { | ||
val client = ExchangeClient("localhost", 30050) | ||
try { | ||
val response = client.SaveRecords() | ||
|
||
println("My records is: " + response.isNice) | ||
} finally { | ||
client.shutdown() | ||
} | ||
} | ||
} | ||
|
||
class ExchangeClient private ( | ||
private val channel: ManagedChannel, | ||
private val blockingStub: ExchangeBlockingStub | ||
) { | ||
private[this] val logger = Logger.getLogger(classOf[WorkerClient].getName) | ||
|
||
def shutdown(): Unit = { | ||
channel.shutdown.awaitTermination(5, TimeUnit.SECONDS) | ||
} | ||
|
||
def SaveRecords(): GetMyRecordsReply = { | ||
logger.info( | ||
"Try to save my records" | ||
) | ||
def saveRecords(records: LazyList[Record]): SaveRecordsReply = { | ||
val request = | ||
SaveRecordsRequest( | ||
records.map(x => ByteString.copyFrom(x.toChars.map(_.toByte))) | ||
) | ||
|
||
val request = GetMyRecordsRequest() | ||
val response = blockingStub.saveRecords(request) | ||
logger.info("My records is: " + response.isNice) | ||
// TODO | ||
|
||
response | ||
blockingStub.saveRecords(request) | ||
} | ||
} |
Oops, something went wrong.