Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studio supports allocation of agent server #351

Merged
merged 76 commits into from
Aug 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0ba7f32
check agent server alive
pan-x-c May 20, 2024
beb7b71
refactor rpc agent proto
pan-x-c May 21, 2024
eca9592
update rpc protoc of agent server
pan-x-c May 21, 2024
d82c4df
support upload source code into agent server
pan-x-c May 21, 2024
485537e
update agent server management test
pan-x-c May 21, 2024
c993e85
update tutorial
pan-x-c May 21, 2024
a3330b6
add psutils to rpc dependency
pan-x-c May 21, 2024
34c09f5
merge main
pan-x-c May 24, 2024
1b40ee4
support download file from agent server
pan-x-c May 24, 2024
8f1a303
add download file test
pan-x-c May 27, 2024
afa0a2f
add get agent memory and set model configs
pan-x-c May 27, 2024
7d592cc
update agent server management tutorial
pan-x-c May 27, 2024
eed97e6
update tutorial
pan-x-c May 27, 2024
f36f803
fix typo
pan-x-c May 28, 2024
ad0a998
fix typo
pan-x-c May 28, 2024
b8fa907
Merge branch 'main' into feature/pxc/agent_server_enhance
pan-x-c May 28, 2024
7fb3f3b
fix pre-commit
pan-x-c May 28, 2024
7dd1421
automatically download files from remote server when update placeholder
pan-x-c May 30, 2024
ca43187
fix conflict
pan-x-c Jun 11, 2024
f1a9835
Merge branch 'main' into feature/pxc/agent_server_enhance
pan-x-c Jun 11, 2024
a212a4f
add stop agent server client side method
pan-x-c Jun 11, 2024
b257af4
add stop server test
pan-x-c Jun 11, 2024
8850fc6
set rpc max meessage size to 32MB
pan-x-c Jun 17, 2024
0c3c337
fix tests
pan-x-c Jun 17, 2024
25b8416
merge main
pan-x-c Jun 18, 2024
80279a5
merge main
pan-x-c Jun 27, 2024
23b954b
Merge branch 'main' into feature/pxc/agent_server_enhance
pan-x-c Jun 27, 2024
351f195
add server studio page and refactor rpc proto
pan-x-c Jun 28, 2024
2627baf
finish agentscope server manager page
pan-x-c Jul 8, 2024
6dd5468
fix server manager page
pan-x-c Jul 8, 2024
c9580d2
remove upload source code
pan-x-c Jul 10, 2024
b85d30b
update tutorial
pan-x-c Jul 10, 2024
a7a8eaa
update test
pan-x-c Jul 10, 2024
380fbd6
mv svg out of html
pan-x-c Jul 12, 2024
64186c6
add delete all agent function
pan-x-c Jul 12, 2024
11c1ff5
add agent memory
pan-x-c Jul 15, 2024
b5876a2
fix comments
pan-x-c Jul 15, 2024
1616356
fix unittest
pan-x-c Jul 15, 2024
f289860
fix comments
pan-x-c Jul 15, 2024
373024f
fix update placeholder error
pan-x-c Jul 15, 2024
8b73ceb
fix simulation
pan-x-c Jul 15, 2024
96b74e1
first balance
pan-x-c Jul 17, 2024
12b945f
merge main
pan-x-c Jul 17, 2024
ee60f3b
finish auto alloc server
pan-x-c Jul 18, 2024
4858165
fix typo
pan-x-c Jul 18, 2024
1cfdd07
fix lazy_launch
pan-x-c Jul 18, 2024
202a550
fix pre-commit
pan-x-c Jul 18, 2024
9bd9bad
servers support load agent dir
pan-x-c Jul 19, 2024
06ed1dd
fix agent dir is none
pan-x-c Jul 19, 2024
d3e41d1
update docs
pan-x-c Jul 19, 2024
490ac1a
update tutorial for agent server manager
pan-x-c Jul 19, 2024
e22e58a
fix dist turtorial
pan-x-c Jul 24, 2024
4575889
Merge branch 'main' into feature/pxc/server_balance
pan-x-c Jul 24, 2024
e811315
update tutorial
pan-x-c Jul 29, 2024
c963c69
update req
pan-x-c Jul 29, 2024
38c6e45
update req
pan-x-c Jul 29, 2024
8cb07cd
update req
pan-x-c Jul 29, 2024
1de6dc6
update req
pan-x-c Jul 29, 2024
626545c
update req
pan-x-c Jul 29, 2024
c1b56b3
update req
pan-x-c Jul 29, 2024
09f0c0b
update req
pan-x-c Jul 29, 2024
b99fc99
update wheel
pan-x-c Jul 29, 2024
bf20616
update ffmpy
pan-x-c Jul 29, 2024
b7b5041
update ffmpy
pan-x-c Jul 29, 2024
d2a392d
update ffmpy
pan-x-c Jul 29, 2024
b498c6a
update ffmpy
pan-x-c Jul 29, 2024
4dd5249
update python
pan-x-c Jul 29, 2024
8ff32bc
update wheel
pan-x-c Jul 29, 2024
7801975
merge main
pan-x-c Jul 29, 2024
cce467a
update workflow
pan-x-c Jul 29, 2024
b50f2ee
fix typo
pan-x-c Aug 5, 2024
4fbc2ba
merge main
pan-x-c Aug 5, 2024
0c36ecc
enhance check port
pan-x-c Aug 5, 2024
57363b8
fix pre-commit
pan-x-c Aug 5, 2024
8ae467d
add security warning in tutorial
pan-x-c Aug 6, 2024
5a1ec2a
add test for auto allocated server not alive
pan-x-c Aug 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add download file test
  • Loading branch information
pan-x-c committed May 27, 2024
commit 8f1a303add3d7ae3fd159cabb3f60eb80790a00b
Binary file added tests/data/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions tests/rpc_agent_test.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
Unit tests for rpc agent classes
"""
import unittest
import os
import time
import shutil
from loguru import logger
@@ -152,6 +153,23 @@ def reply(self, x: dict = None) -> dict:
raise RuntimeError("Demo Error")


class FileAgent(AgentBase):
"""An agent returns a file"""

def reply(self, x: dict = None) -> dict:
image_path = os.path.abspath(
os.path.join(
os.path.abspath(os.path.dirname(__file__)), "data", "image.png"
)
)
return Msg(
name=self.name,
role="assistant",
content="Image",
url=image_path,
)


class BasicRpcAgentTest(unittest.TestCase):
"Test cases for Rpc Agent"

@@ -680,4 +698,21 @@ def test_agent_server_management_funcs(self) -> None:
self.assertTrue("CPU Times" in server_info)
self.assertTrue("CPU Percent" in server_info)
self.assertTrue("Memory Usage" in server_info)
# test download file
file_agent = FileAgent("File").to_dist(
host="localhost",
port=launcher.port,
upload_source_code=True,
)
file = file_agent()
remote_file_path = file.url
local_file_path = client.download_file(remote_file_path)
self.assertNotEqual(remote_file_path, local_file_path)
with open(remote_file_path, "rb") as rf:
remote_content = rf.read()
with open(local_file_path, "rb") as lf:
local_content = lf.read()
self.assertEqual(remote_content, local_content)
agent_ids = client.get_agent_id_list()
self.assertEqual(len(agent_ids), 2)
launcher.shutdown()
Loading