Reimplement scoring and create connection abstraction

Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
This commit is contained in:
Konrad Hanff
2021-03-31 16:18:21 +02:00
committed by Sebastian Serth
parent 1546f70818
commit 92b249e7b3
5 changed files with 172 additions and 111 deletions

View File

@@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'container_connection'
class Container
BASE_URL = "http://192.168.178.53:5000"
attr_accessor :socket
def initialize(execution_environment, time_limit = nil)
url = "#{BASE_URL}/execution-environments/#{execution_environment.id}/containers/create"
body = {}
@@ -39,7 +39,11 @@ class Container
def execute_interactively(command)
websocket_url = execute_command(command)[:websocket_url]
@socket = Faye::WebSocket::Client.new(websocket_url, [], ping: 0.1)
EventMachine.run do
#socket = Faye::WebSocket::Client.new(websocket_url, [], ping: 0.1)
socket = ContainerConnection.new(websocket_url)
yield(self, socket) if block_given?
end
end
def destroy