Skip to content

Commit

Permalink
Fix delete job + crash point test
Browse files Browse the repository at this point in the history
  • Loading branch information
Willfrit committed Apr 28, 2019
1 parent 023bd30 commit 3f2ac34
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions app_test/crash_point.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
print("CRASH_POINT.LUA START")

require("splay.base")
local math = require("math")
local net = require("splay.net")
local misc = require("splay.misc")

function receive(s)
local ip, port = s:getpeername()
while events.yield() do
local data, err = s:receive("*l")
print("I received : "..data)
-- CRASH POINT 2 : STOP : AFTER 6
end
end

function send(s)
while events.yield() do
-- CRASH POINT 1 : RECOVERY 1 : AFTER 3
events.sleep(0.5)
print("I send data")
s:send("I AM "..job.position.."\n")
end
end

function init(s, connect)
local ip, port = s:getpeername()
print("Connection accepted with : "..ip..":"..port)
end

function final(s)
local ip, port = s:getpeername()
print("Closing: "..ip..":"..port)
end

events.run(function()
-- Accept connection from other nodes
net.server(job.me.port, {initialize = init, send = send, receive = receive, finalize = final})

-- Launch connection to each orther node
events.thread(function ()
events.sleep(1)
for i, n in pairs(job.nodes) do
if n.port ~= job.me.port or n.ip ~= job.me.ip then
print("Try to begin connection to "..n.ip..":"..n.port.." - index "..i)
net.client(n, {initialize = init, send = send, receive = receive, finalize = final})
end
end
end)

-- Crash point or kill before
end)

2 changes: 1 addition & 1 deletion cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def kill_job(job_id):
headers = authentified_headers()
response = requests.delete(endpoint, headers=headers)
check_response(response)
click.echo(response.json())
click.echo("Success kill")

@main.command()
@click.argument('job_id', nargs=1)
Expand Down

0 comments on commit 3f2ac34

Please sign in to comment.