mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2026-01-07 23:54:23 +01:00
feat: auto jina login
This commit is contained in:
@@ -7,10 +7,26 @@ from argparse import Namespace
|
||||
from pathlib import Path
|
||||
|
||||
import hubble
|
||||
from hubble import AuthenticationRequiredError
|
||||
from hubble.executor.helper import upload_file, archive_package, get_request_header
|
||||
from jcloud.flow import CloudFlow
|
||||
from jina import Flow
|
||||
|
||||
from src.utils.common import cmd
|
||||
|
||||
|
||||
@hubble.login_required
|
||||
def _jina_auth_login():
|
||||
pass
|
||||
|
||||
|
||||
def jina_auth_login():
|
||||
try:
|
||||
_jina_auth_login()
|
||||
except AuthenticationRequiredError:
|
||||
print('Please login to Jina first, to fully use GPTDeploy')
|
||||
cmd('jina auth login')
|
||||
|
||||
|
||||
|
||||
def push_executor(dir_path):
|
||||
|
||||
15
src/utils/common.py
Normal file
15
src/utils/common.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import subprocess
|
||||
|
||||
|
||||
def cmd(command, std_output=False, wait=True):
|
||||
if isinstance(command, str):
|
||||
command = command.split()
|
||||
if not std_output:
|
||||
process = subprocess.Popen(
|
||||
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||
)
|
||||
else:
|
||||
process = subprocess.Popen(command)
|
||||
if wait:
|
||||
output, error = process.communicate()
|
||||
return output, error
|
||||
Reference in New Issue
Block a user