mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-21 15:44:19 +01:00
feat: server
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import os
|
||||
from multiprocessing.connection import Client
|
||||
|
||||
import hubble
|
||||
from jcloud.flow import CloudFlow
|
||||
from jina import Flow
|
||||
|
||||
from src.constants import FLOW_URL_PLACEHOLDER
|
||||
|
||||
|
||||
def push_executor():
|
||||
cmd = 'jina hub push executor/. --verbose'
|
||||
@@ -46,4 +49,24 @@ executors:
|
||||
with flow:
|
||||
pass
|
||||
|
||||
return CloudFlow(path=full_flow_path).__enter__().endpoints['gateway']
|
||||
return CloudFlow(path=full_flow_path).__enter__().endpoints['gateway']
|
||||
|
||||
def replace_client_line(file_content: str, replacement: str) -> str:
|
||||
lines = file_content.split('\n')
|
||||
for index, line in enumerate(lines):
|
||||
if 'Client(' in line:
|
||||
lines[index] = replacement
|
||||
break
|
||||
return '\n'.join(lines)
|
||||
|
||||
def run_client_file(file_path, host):
|
||||
with open(file_path, 'r') as file:
|
||||
content = file.read()
|
||||
|
||||
replaced_content = replace_client_line(content, f"client = Client(host='{host}')")
|
||||
|
||||
|
||||
with open(file_path, 'w') as file:
|
||||
file.write(replaced_content)
|
||||
|
||||
import executor.client # runs the client script for validation
|
||||
|
||||
Reference in New Issue
Block a user