Skip to content

Commit dc7b81d

Browse files
authored
Added docstrings from origin functions to proxy side functions (#9)
* Added docstrings from origin functions to proxy side functions * Updated min version of tests to p38 * Updated min version of tests to p38 * removed tests from package workflow --------- Co-authored-by: Codemation <>
1 parent 1c0d6f8 commit dc7b81d

5 files changed

Lines changed: 7 additions & 206 deletions

File tree

.github/workflows/main.yaml

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,7 @@
11
name: Test EasyRpc Core Functionality
22
on: ['pull_request']
33
jobs:
4-
test_easyrpc_core_37:
5-
# Containers must run in Linux based operating systems
6-
runs-on: ubuntu-latest
7-
# Docker Hub image that `container-job` executes in
8-
#container: joshjamison/python38:latest
9-
strategy:
10-
matrix:
11-
python-version: [3.7]
12-
steps:
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
# Downloads a copy of the code in your repository before running CI tests
18-
- name: Check out repository code
19-
uses: actions/checkout@v2
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
24-
pip install pytest requests pytest-asyncio
25-
- name: Test EasyRpc Core Functionality
26-
run: |
27-
pytest tests/test_core.py
28-
test_easyrpc_cluster_1_37:
29-
needs: test_easyrpc_core_37
30-
# Containers must run in Linux based operating systems
31-
runs-on: ubuntu-latest
32-
# Docker Hub image that `container-job` executes in
33-
#container: joshjamison/python38:latest
34-
strategy:
35-
matrix:
36-
python-version: [3.7]
37-
steps:
38-
- name: Set up Python ${{ matrix.python-version }}
39-
uses: actions/setup-python@v2
40-
with:
41-
python-version: ${{ matrix.python-version }}
42-
# Downloads a copy of the code in your repository before running CI tests
43-
- name: Check out repository code
44-
uses: actions/checkout@v2
45-
- name: Install dependencies
46-
run: |
47-
python -m pip install --upgrade pip
48-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
49-
pip install pytest requests pytest-asyncio
50-
- name: Test EasyRpc Cluster Functionality - 1
51-
run: |
52-
pytest tests/test_clustering_1.py
53-
test_easyrpc_cluster_2_37:
54-
needs: test_easyrpc_cluster_1_37
55-
# Containers must run in Linux based operating systems
56-
runs-on: ubuntu-latest
57-
# Docker Hub image that `container-job` executes in
58-
#container: joshjamison/python38:latest
59-
strategy:
60-
matrix:
61-
python-version: [3.7]
62-
steps:
63-
- name: Set up Python ${{ matrix.python-version }}
64-
uses: actions/setup-python@v2
65-
with:
66-
python-version: ${{ matrix.python-version }}
67-
# Downloads a copy of the code in your repository before running CI tests
68-
- name: Check out repository code
69-
uses: actions/checkout@v2
70-
- name: Install dependencies
71-
run: |
72-
python -m pip install --upgrade pip
73-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
74-
pip install pytest requests pytest-asyncio
75-
- name: Test EasyRpc Cluster Functionality - 2
76-
run: |
77-
pytest tests/test_clustering_2.py
78-
test_easyrpc_cluster_3_37:
79-
needs: test_easyrpc_cluster_2_37
80-
# Containers must run in Linux based operating systems
81-
runs-on: ubuntu-latest
82-
# Docker Hub image that `container-job` executes in
83-
#container: joshjamison/python38:latest
84-
strategy:
85-
matrix:
86-
python-version: [3.7]
87-
steps:
88-
- name: Set up Python ${{ matrix.python-version }}
89-
uses: actions/setup-python@v2
90-
with:
91-
python-version: ${{ matrix.python-version }}
92-
# Downloads a copy of the code in your repository before running CI tests
93-
- name: Check out repository code
94-
uses: actions/checkout@v2
95-
- name: Install dependencies
96-
run: |
97-
python -m pip install --upgrade pip
98-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
99-
pip install pytest requests pytest-asyncio
100-
- name: Test EasyRpc Cluster Functionality - 3
101-
run: |
102-
pytest tests/test_clustering_3.py
1034
test_easyrpc_core_38:
104-
needs: test_easyrpc_cluster_3_37
1055
# Containers must run in Linux based operating systems
1066
runs-on: ubuntu-latest
1077
# Docker Hub image that `container-job` executes in

.github/workflows/package.yaml

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -4,108 +4,8 @@ on:
44
tags:
55
- "*"
66
jobs:
7-
test_easyrpc_core:
8-
# Containers must run in Linux based operating systems
9-
runs-on: ubuntu-latest
10-
# Docker Hub image that `container-job` executes in
11-
#container: joshjamison/python38:latest
12-
strategy:
13-
matrix:
14-
python-version: [3.8]
15-
steps:
16-
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
18-
with:
19-
python-version: ${{ matrix.python-version }}
20-
# Downloads a copy of the code in your repository before running CI tests
21-
- name: Check out repository code
22-
uses: actions/checkout@v2
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
27-
pip install pytest requests pytest-asyncio
28-
- name: Test EasyRpc Core Functionality
29-
run: |
30-
pytest tests/test_core.py
31-
test_easyrpc_cluster_1:
32-
# Containers must run in Linux based operating systems
33-
needs: test_easyrpc_core
34-
runs-on: ubuntu-latest
35-
# Docker Hub image that `container-job` executes in
36-
#container: joshjamison/python38:latest
37-
strategy:
38-
matrix:
39-
python-version: [3.8]
40-
steps:
41-
- name: Set up Python ${{ matrix.python-version }}
42-
uses: actions/setup-python@v2
43-
with:
44-
python-version: ${{ matrix.python-version }}
45-
# Downloads a copy of the code in your repository before running CI tests
46-
- name: Check out repository code
47-
uses: actions/checkout@v2
48-
- name: Install dependencies
49-
run: |
50-
python -m pip install --upgrade pip
51-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
52-
pip install pytest requests pytest-asyncio
53-
- name: Test EasyRpc Cluster Functionality - 1
54-
run: |
55-
pytest tests/test_clustering_1.py
56-
test_easyrpc_cluster_2:
57-
needs: test_easyrpc_cluster_1
58-
# Containers must run in Linux based operating systems
59-
runs-on: ubuntu-latest
60-
# Docker Hub image that `container-job` executes in
61-
#container: joshjamison/python38:latest
62-
strategy:
63-
matrix:
64-
python-version: [3.8]
65-
steps:
66-
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v2
68-
with:
69-
python-version: ${{ matrix.python-version }}
70-
# Downloads a copy of the code in your repository before running CI tests
71-
- name: Check out repository code
72-
uses: actions/checkout@v2
73-
- name: Install dependencies
74-
run: |
75-
python -m pip install --upgrade pip
76-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
77-
pip install pytest requests pytest-asyncio
78-
- name: Test EasyRpc Cluster Functionality - 2
79-
run: |
80-
pytest tests/test_clustering_2.py
81-
test_easyrpc_cluster_3:
82-
needs: test_easyrpc_cluster_2
83-
# Containers must run in Linux based operating systems
84-
runs-on: ubuntu-latest
85-
# Docker Hub image that `container-job` executes in
86-
#container: joshjamison/python38:latest
87-
strategy:
88-
matrix:
89-
python-version: [3.8]
90-
steps:
91-
- name: Set up Python ${{ matrix.python-version }}
92-
uses: actions/setup-python@v2
93-
with:
94-
python-version: ${{ matrix.python-version }}
95-
# Downloads a copy of the code in your repository before running CI tests
96-
- name: Check out repository code
97-
uses: actions/checkout@v2
98-
- name: Install dependencies
99-
run: |
100-
python -m pip install --upgrade pip
101-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
102-
pip install pytest requests pytest-asyncio
103-
- name: Test EasyRpc Cluster Functionality - 3
104-
run: |
105-
pytest tests/test_clustering_3.py
1067
package:
1078
name: Package easyrpc for PyPI
108-
needs: test_easyrpc_cluster_3
1099
runs-on: ubuntu-latest
11010
steps:
11111
# Downloads a copy of the code in your repository before running CI tests

easyrpc/proxy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def create(cls,
155155

156156
def run_cron(self, action, interval):
157157
async def cron():
158-
self.log.warning(f"creating cron or {action.__name__} - interval {interval}")
158+
self.log.debug(f"creating cron or {action.__name__} - interval {interval}")
159159
tasks = []
160160
while True:
161161
try:
@@ -466,7 +466,7 @@ async def ws_client():
466466
ws_sender = self.get_ws_sender(ws)
467467
ws_receiver = self.get_ws_receiver(ws)
468468

469-
self.log.warning(
469+
self.log.debug(
470470
f"started connection to server {self.origin_host}:{self.origin_port}"
471471
)
472472
async def keep_alive():

easyrpc/register.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ async def __proxy__(*args, **kwargs):
4646
return await result
4747
return result
4848

49-
#__proxy__.__name__ = f"{config['name']}_proxy"
5049
__proxy__.__name__ = f"{config['name']}"
50+
__proxy__.__doc__ = config.get('doc', '')
5151
nf = create_function(
5252
create_signature_from_dict(
5353
config['sig']
@@ -126,6 +126,7 @@ def register(f, namespace):
126126
obj.namespaces[namespace][f.__name__]['config'] = {
127127
'sig': get_signature_as_dict(f),
128128
'name': f.__name__,
129+
'doc': f.__doc__,
129130
'is_async': iscoroutinefunction(f)
130131
}
131132
obj.namespaces[namespace][f.__name__]['method'] = f

easyrpc/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ async def connect(self, websocket: WebSocket):
2323
return await websocket.accept()
2424

2525
def store_connect(self, endpoint_id, websocket: WebSocket):
26-
self.log.warning(f"created websocket connection with endpoint {endpoint_id}")
26+
self.log.debug(f"created websocket connection with endpoint {endpoint_id}")
2727
self.active_connections[endpoint_id] = websocket
2828

2929
def disconnect(self, endpoint_id: str):
30-
self.log.warning(f"deleted websocket connection with endpoint {endpoint_id}")
30+
self.log.debug(f"deleted websocket connection with endpoint {endpoint_id}")
3131
del self.active_connections[endpoint_id]
3232
async def broadcast(self, message: str):
3333
for connection in self.active_connections:
@@ -422,7 +422,7 @@ async def ws_receiver():
422422
await finished.get()
423423

424424
# child connection closed
425-
self.log.warning(f"client websocket connection with id {decoded_id} finished")
425+
self.log.debug(f"client websocket connection with id {decoded_id} finished")
426426

427427
# check if child is server or proxy
428428
if setup['type'] == 'SERVER':

0 commit comments

Comments
 (0)