Skip to content
Snippets Groups Projects
Commit 2238a261 authored by zf4's avatar zf4
Browse files

Startup logging

parent 7ec1ad89
No related branches found
No related tags found
No related merge requests found
Pipeline #80173 canceled
......@@ -68,12 +68,13 @@ func ConnectCraneMaster() {
port := strconv.Itoa(shared.CraneServerCilentPort)
masterConn = connectToServer(masterAddr, port)
masterBackupConn = connectToServer(masterBackupAddr, port)
fmt.Println("Crane client started.")
}
func connectToServer(addr string, port string) net.Conn {
conn, err := net.Dial("tcp", addr+":"+"port")
if err != nil {
panic(err)
fmt.Println(err)
}
return conn
}
......
......@@ -52,6 +52,7 @@ func StartMaster() {
go CheckMasterStatus()
go ListenForClient()
go ListenForDataCollection()
fmt.Println("Crane master started.")
}
// InitializeCraneMaster - initialize the master
......
......@@ -47,6 +47,8 @@ func StartWorking() {
go handleMasterRequest(backupListen)
// accept worker's tuples
go handleWorkerRequest(workerListen)
fmt.Println("Crane worker started.")
}
func handleMasterRequest(currListen net.Listener) {
......
......@@ -15,13 +15,14 @@ import (
)
const CMD_PROMPT = "> "
var craneType := 0
func main() {
println("Starting server")
log.SetFlags(log.Lshortfile)
failure.Initialize()
// TODO: read cmd input to determine if this is a crane master/client
go func() {
println("Type 'help' for list of commands")
fmt.Printf("[Server %d]%s", shared.GetOwnServerNumber(), CMD_PROMPT)
......@@ -38,6 +39,18 @@ func main() {
file_sys.Initialize()
grep_server.Initialize()
// Setup as server, client, or worker
if os.Args[1] == "crane-client" {
craneType = 1
go crane.ConnectCraneMaster()
} else if shared.GetOwnServerNumber() == 2 || shared.GetOwnServerNumber() == 3 {
craneType = 2
go crane.StartMaster()
} else {
craneType = 3
go crane.StartWorking()
}
println("Finished starting server")
// Keep the program running so it doesn't close the port
for {
......@@ -85,6 +98,7 @@ func HandleServerCommand(cmd string) {
case "bolt":
{
// Usage: bolt [pluginName] [boltName] [ancestorName1 ancestorName2 ...
crane.ProcessCraneTopology(com[1:])
}
case "submit":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment