Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
Coco58323 committed Sep 10, 2021
1 parent ff2b4f7 commit d4a3875
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion mars/services/mutable/supervisor/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from .core import normailize_index
import sys
import itertools
from typing import OrderedDict,Union,List
from typing import Union,List
from collections import OrderedDict
from ....tensor.utils import split_indexes_into_chunks,decide_chunk_sizes
from .... import oscar as mo
from ..worker.service import MutableTensorChunkActor
Expand Down
4 changes: 2 additions & 2 deletions mars/services/mutable/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# limitations under the License.


from mars.services.mutable.supervisor.service import MutableTensor
from ..supervisor.service import MutableTensor
import pytest
import numpy as np
from mars.deploy.oscar.local import new_cluster
from ....deploy.oscar.local import new_cluster


@pytest.mark.asyncio
Expand Down
2 changes: 1 addition & 1 deletion mars/services/mutable/worker/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import OrderedDict
from collections import OrderedDict
from .... import oscar as mo
from .core import Chunk

Expand Down
12 changes: 7 additions & 5 deletions mars/services/session/api/web.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -127,13 +128,13 @@ def __init__(self, address: str):
async def get_sessions(self) -> List[SessionInfo]:
addr = f'{self._address}/api/session'
res = await self._request_url('GET', addr)
res_obj = json.loads((await res.read()).decode())
res_obj = json.loads(res.body.decode())
return [SessionInfo(**kw) for kw in res_obj['sessions']]

async def create_session(self, session_id: str) -> str:
addr = f'{self._address}/api/session/{session_id}'
res = await self._request_url(path=addr, method='PUT', data=b'')
return (await res.read()).decode()
return res.body.decode()

async def delete_session(self, session_id: str):
addr = f'{self._address}/api/session/{session_id}'
Expand All @@ -143,14 +144,14 @@ async def has_session(self, session_id: str):
addr = f'{self._address}/api/session/{session_id}'
params = dict(action='check_exist')
res = await self._request_url('GET', addr, params=params)
return bool(int(await res.read()))
return bool(int(res.body.decode()))

async def get_last_idle_time(self, session_id: Union[str, None] = None) -> Union[float, None]:
session_id = session_id or ''
addr = f'{self._address}/api/session/{session_id}'
params = dict(action='get_last_idle_time')
res = await self._request_url('GET', addr, params=params)
content = await res.read()
content = res.body.decode()
return float(content) if content else None

async def fetch_tileable_op_logs(self,
Expand All @@ -164,6 +165,7 @@ async def fetch_tileable_op_logs(self,
res = await self._request_url('GET', addr, params=params)
return json.loads(res.body.decode())


async def create_mutable_tensor(self,
session_id: str,
shape: tuple,
Expand All @@ -174,4 +176,4 @@ async def create_mutable_tensor(self,
pass

async def get_mutable_tensor(self, session_id:str,name: str):
pass
pass
3 changes: 2 additions & 1 deletion mars/services/session/supervisor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import asyncio
import uuid
import functools
from typing import Dict, List, Optional, OrderedDict
from typing import Dict, List, Optional
from collections import OrderedDict

from .... import oscar as mo
from ....utils import to_binary
Expand Down

0 comments on commit d4a3875

Please sign in to comment.