-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate
async-container-supervisor
.
- Loading branch information
Showing
16 changed files
with
228 additions
and
231 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,21 @@ | ||
export const options = { | ||
stages: [ | ||
// Warmup: Gradually ramp up: | ||
{duration: '10s', target: 64}, | ||
|
||
// Main test: Sustained load: | ||
{duration: '1m', target: 64}, | ||
], | ||
}; | ||
|
||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
|
||
export default function () { | ||
const res = http.get('http://localhost:9292/small'); | ||
|
||
check(res, { | ||
'is status 200': (r) => r.status === 200, | ||
'response time < 200ms': (r) => r.timings.duration < 200, | ||
}); | ||
} |
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,8 @@ | ||
FROM llama2 | ||
# sets the temperature to 1 [higher is more creative, lower is more coherent] | ||
PARAMETER temperature 1 | ||
# sets the context window size to 4096, this controls how many tokens the LLM can use as context to generate the next token | ||
PARAMETER num_ctx 4096 | ||
|
||
# sets a custom system message to specify the behavior of the chat assistant | ||
SYSTEM You find yourself at the entrance to a dungeon. What do you do next? |
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,37 @@ | ||
FROM llama2:13b | ||
|
||
PARAMETER num_ctx 16384 | ||
|
||
SYSTEM """ | ||
You are an entity in a role playing game. You will receive input from the game world and must respond with actions. Input from the game world will include nearby events and dialogue. You can perform one or more actions include speaking, moving and using things in the world. You must ONLY respond with actions in the specified format otherwise the game will respond with ERROR to inform you that the input was not understood, and you should try again using one of the defined actions. | ||
|
||
Inputs will be formatted in the following way: | ||
|
||
TIME [time] | ||
The game world has advanced to the specified time. | ||
SEE [entity] [distance] [action] | ||
You see something. | ||
HEAR [entity] [distance] [dialogue] | ||
You hear something. | ||
ARRIVE [entity] | ||
You arrive somewhere. | ||
ERROR [message] | ||
Your action was not understood (perhaps try again). | ||
|
||
Actions must be formatted in the following way: | ||
|
||
MOVE TOWARDS [entity] | ||
You will begin moving towards the named entity. | ||
SPEAK "dialogue" | ||
You will speak the specified dialogue. | ||
USE [entity] | ||
You will use the named entity. | ||
LOOK | ||
You will look around and the game will inform you of nearby entities. | ||
PASS | ||
Do nothing. | ||
|
||
Before you try to interact with things, ensure you LOOK to see what is available. Then, MOVE TOWARDS the entity. Finally the game world will inform you when you ARRIVE at the entity. You may perform more than one action at a time if you list them on separate lines. | ||
|
||
The entity you are simulating is a cat. | ||
""" |
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,89 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2021-2023, by Samuel Williams. | ||
|
||
$LOAD_PATH << File.expand_path("../../lib", __dir__) | ||
$LOAD_PATH << File.expand_path("../../ext", __dir__) | ||
|
||
require "io/event" | ||
|
||
require "socket" | ||
require "fiber" | ||
|
||
class Scheduler | ||
def initialize(selector = nil) | ||
@fiber = Fiber.current | ||
@selector = selector || IO::Event::Selector.new(@fiber) | ||
@pending = [] | ||
@waiting = {} | ||
|
||
unless @selector.respond_to?(:io_close) | ||
instance_eval{undef io_close} | ||
end | ||
|
||
@mutex = Mutex.new | ||
end | ||
|
||
def block(blocker, timeout) | ||
raise NotImplementedError | ||
end | ||
|
||
def unblock(blocker, fiber) | ||
raise NotImplementedError | ||
end | ||
|
||
def io_wait(io, events, timeout) | ||
fiber = Fiber.current | ||
@waiting[fiber] = io | ||
@selector.io_wait(fiber, io, events) | ||
ensure | ||
@waiting.delete(fiber) | ||
end | ||
|
||
def io_close(io) | ||
@selector.io_close(io) | ||
end | ||
|
||
def kernel_sleep(duration) | ||
@selector.defer | ||
end | ||
|
||
def close | ||
while @selector.ready? || @waiting.any? | ||
begin | ||
@selector.select(nil) | ||
rescue Errno::EINTR | ||
# Ignore. | ||
end | ||
end | ||
rescue Interrupt | ||
# Exit. | ||
end | ||
|
||
def fiber(&block) | ||
fiber = Fiber.new(&block) | ||
|
||
@selector.resume(fiber) | ||
|
||
return fiber | ||
end | ||
end | ||
|
||
class DirectScheduler < Scheduler | ||
def io_read(io, buffer, length) | ||
fiber = Fiber.current | ||
@waiting[fiber] = io | ||
result = @selector.io_read(fiber, io, buffer, length) | ||
ensure | ||
@waiting.delete(fiber) | ||
end | ||
|
||
def io_write(io, buffer, length) | ||
fiber = Fiber.current | ||
@waiting[fiber] = io | ||
@selector.io_write(fiber, io, buffer, length) | ||
ensure | ||
@waiting.delete(fiber) | ||
end | ||
end |
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,33 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2021-2023, by Samuel Williams. | ||
|
||
require_relative "scheduler" | ||
require "io/nonblock" | ||
|
||
#scheduler = DirectScheduler.new | ||
scheduler = Scheduler.new | ||
Fiber.set_scheduler(scheduler) | ||
|
||
port = Integer(ARGV.pop || 3020) | ||
|
||
RESPONSE = "HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nHello World" | ||
|
||
Fiber.schedule do | ||
server = TCPServer.new("localhost", port) | ||
server.listen(Socket::SOMAXCONN) | ||
|
||
loop do | ||
peer, address = server.accept | ||
|
||
Fiber.schedule do | ||
while request_line = peer.readpartial(1024) rescue nil | ||
peer.write(RESPONSE) | ||
end | ||
ensure | ||
peer.close | ||
end | ||
end | ||
end |
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
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
Oops, something went wrong.