Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs425-mp4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
zf4
cs425-mp4
Commits
2238a261
Commit
2238a261
authored
6 years ago
by
zf4
Browse files
Options
Downloads
Patches
Plain Diff
Startup logging
parent
7ec1ad89
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#80173
canceled
6 years ago
Stage: build
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/crane/crane_client.go
+2
-1
2 additions, 1 deletion
src/crane/crane_client.go
src/crane/crane_master.go
+1
-0
1 addition, 0 deletions
src/crane/crane_master.go
src/crane/worker.go
+2
-0
2 additions, 0 deletions
src/crane/worker.go
src/main.go
+15
-1
15 additions, 1 deletion
src/main.go
with
20 additions
and
2 deletions
src/crane/crane_client.go
+
2
−
1
View file @
2238a261
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
src/crane/crane_master.go
+
1
−
0
View file @
2238a261
...
...
@@ -52,6 +52,7 @@ func StartMaster() {
go
CheckMasterStatus
()
go
ListenForClient
()
go
ListenForDataCollection
()
fmt
.
Println
(
"Crane master started."
)
}
// InitializeCraneMaster - initialize the master
...
...
This diff is collapsed.
Click to expand it.
src/crane/worker.go
+
2
−
0
View file @
2238a261
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main.go
+
15
−
1
View file @
2238a261
...
...
@@ -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"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment