fix: improve output

This commit is contained in:
Joschka Braun
2023-04-06 17:11:14 +02:00
parent baa7424a65
commit 15f4fb5761
2 changed files with 5 additions and 27 deletions

View File

@@ -7,26 +7,19 @@ from argparse import Namespace
from pathlib import Path from pathlib import Path
import hubble import hubble
from hubble import AuthenticationRequiredError
from hubble.executor.helper import upload_file, archive_package, get_request_header from hubble.executor.helper import upload_file, archive_package, get_request_header
from jcloud.flow import CloudFlow from jcloud.flow import CloudFlow
from jina import Flow
from src.utils.common import cmd
@hubble.login_required def redirect_callback(href):
def _jina_auth_login(): print(f'You need login to Jina first to use GPTDeploy\nPlease open this link in your browser: {href}')
pass
def jina_auth_login(): def jina_auth_login():
try: try:
_jina_auth_login() hubble.Client(jsonify=True).get_user_info(log_error=False)
except AuthenticationRequiredError: except hubble.AuthenticationRequiredError:
print('Please login to Jina first, to fully use GPTDeploy') hubble.login(prompt='login', redirect_callback=redirect_callback)
cmd('jina auth login')
def push_executor(dir_path): def push_executor(dir_path):

View File

@@ -1,15 +0,0 @@
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