Skip to content

Commit

Permalink
feat: added ipc message
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Nov 24, 2024
1 parent 0bed19b commit 9b6027d
Show file tree
Hide file tree
Showing 30 changed files with 236 additions and 1,989 deletions.
2 changes: 0 additions & 2 deletions crawlab/client/__init__.py

This file was deleted.

54 changes: 0 additions & 54 deletions crawlab/client/client.py

This file was deleted.

29 changes: 16 additions & 13 deletions crawlab/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
import json
import os

from crawlab.constants.upload import CLI_DEFAULT_CONFIG_ROOT_DIR, CLI_DEFAULT_CONFIG_CLI_DIR, \
CLI_DEFAULT_CONFIG_FILE_NAME, \
CLI_DEFAULT_CONFIG_KEY_PASSWORD
from crawlab.constants.upload import (
CLI_DEFAULT_CONFIG_CLI_DIR,
CLI_DEFAULT_CONFIG_FILE_NAME,
CLI_DEFAULT_CONFIG_KEY_PASSWORD,
CLI_DEFAULT_CONFIG_ROOT_DIR,
)

home = os.curdir

if 'HOME' in os.environ:
home = os.environ['HOME']
elif os.name == 'posix':
home = os.path.expanduser('~/')
elif os.name == 'nt':
if 'HOMEPATH' in os.environ and 'HOMEDRIVE' in os.environ:
home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
elif 'HOMEPATH' in os.environ:
home = os.environ['HOMEPATH']
if "HOME" in os.environ:
home = os.environ["HOME"]
elif os.name == "posix":
home = os.path.expanduser("~/")
elif os.name == "nt":
if "HOMEPATH" in os.environ and "HOMEDRIVE" in os.environ:
home = os.environ["HOMEDRIVE"] + os.environ["HOMEPATH"]
elif "HOMEPATH" in os.environ:
home = os.environ["HOMEPATH"]

CRAWLAB_ROOT_PATH = os.path.join(home, CLI_DEFAULT_CONFIG_ROOT_DIR)
CRAWLAB_CLI_PATH = os.path.join(CRAWLAB_ROOT_PATH, CLI_DEFAULT_CONFIG_CLI_DIR)
Expand Down Expand Up @@ -55,7 +58,7 @@ def load(self):
self.data = ConfigData(json.loads(data_str))

def save(self):
with open(self.json_path, 'wb') as f:
with open(self.json_path, "wb") as f:
f.write(self.data.json.encode())

def set(self, key: str, value: str):
Expand Down
13 changes: 0 additions & 13 deletions crawlab/config/task.py

This file was deleted.

File renamed without changes.
25 changes: 0 additions & 25 deletions crawlab/entity/address.py

This file was deleted.

9 changes: 9 additions & 0 deletions crawlab/entity/ipc_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import Iterable, Literal, Optional

from pydantic import BaseModel, Field


class IPCMessage(BaseModel):
type: Optional[Literal["data", "log"]] = Field(description="Message type")
ipc: bool = Field(description="The message is IPC", default=True)
payload: Iterable[dict] | dict = Field(description="Message payload")
9 changes: 0 additions & 9 deletions crawlab/entity/result.py

This file was deleted.

55 changes: 0 additions & 55 deletions crawlab/grpc/entity/model_service_request_pb2.py

This file was deleted.

29 changes: 0 additions & 29 deletions crawlab/grpc/entity/model_service_request_pb2_grpc.py

This file was deleted.

29 changes: 0 additions & 29 deletions crawlab/grpc/entity/response_pb2.py

This file was deleted.

29 changes: 0 additions & 29 deletions crawlab/grpc/entity/response_pb2_grpc.py

This file was deleted.

40 changes: 0 additions & 40 deletions crawlab/grpc/services/dependency_service_pb2.py

This file was deleted.

Loading

0 comments on commit 9b6027d

Please sign in to comment.