Spaces:
Running
Running
minor
Browse files- start_app.py +4 -4
start_app.py
CHANGED
@@ -46,9 +46,9 @@ def parse_log(line: str, pbars: dict[str, float] = None):
|
|
46 |
return ""
|
47 |
|
48 |
def dry_run(src, config, split, dst, query):
|
49 |
-
if not all([src,
|
50 |
raise gr.Error("Please fill source, destination and query.")
|
51 |
-
args = ["--src", src
|
52 |
cmd = CMD + args
|
53 |
logs = "Job:\n\n```bash\n" + " ".join('"' + arg.replace('"', '\"""') + '"' if " " in arg else arg for arg in cmd) + "\n```\nOutput:\n\n"
|
54 |
yield {output_markdown: logs, progress_labels: gr.Label(visible=False), details_accordion: gr.Accordion(open=True)}
|
@@ -58,7 +58,7 @@ def dry_run(src, config, split, dst, query):
|
|
58 |
yield {output_markdown: logs}
|
59 |
|
60 |
def run(src, config, split, dst, query, oauth_token: gr.OAuthToken | None, profile: gr.OAuthProfile | None):
|
61 |
-
if not all([src,
|
62 |
raise gr.Error("Please fill source, destination and query.")
|
63 |
if oauth_token and profile:
|
64 |
token = oauth_token.token
|
@@ -67,7 +67,7 @@ def run(src, config, split, dst, query, oauth_token: gr.OAuthToken | None, profi
|
|
67 |
username = HfApi().whoami(token=token)["name"]
|
68 |
else:
|
69 |
raise gr.Error("Please log in to run the job.")
|
70 |
-
args = ["--src", src
|
71 |
cmd = CMD + args
|
72 |
logs = "Job:\n\n```bash\n" + " ".join('"' + arg.replace('"', '\"""') + '"' if " " in arg else arg for arg in cmd) + "\n```\nOutput:\n\n"
|
73 |
pbars = {}
|
|
|
46 |
return ""
|
47 |
|
48 |
def dry_run(src, config, split, dst, query):
|
49 |
+
if not all([src, dst, query]):
|
50 |
raise gr.Error("Please fill source, destination and query.")
|
51 |
+
args = ["--src", src] + (["--config", config] if config else []) + (["--split", split] if split else []) + [ "--dst", dst, "--query", query, DRY_RUN]
|
52 |
cmd = CMD + args
|
53 |
logs = "Job:\n\n```bash\n" + " ".join('"' + arg.replace('"', '\"""') + '"' if " " in arg else arg for arg in cmd) + "\n```\nOutput:\n\n"
|
54 |
yield {output_markdown: logs, progress_labels: gr.Label(visible=False), details_accordion: gr.Accordion(open=True)}
|
|
|
58 |
yield {output_markdown: logs}
|
59 |
|
60 |
def run(src, config, split, dst, query, oauth_token: gr.OAuthToken | None, profile: gr.OAuthProfile | None):
|
61 |
+
if not all([src, dst, query]):
|
62 |
raise gr.Error("Please fill source, destination and query.")
|
63 |
if oauth_token and profile:
|
64 |
token = oauth_token.token
|
|
|
67 |
username = HfApi().whoami(token=token)["name"]
|
68 |
else:
|
69 |
raise gr.Error("Please log in to run the job.")
|
70 |
+
args = ["--src", src] + (["--config", config] if config else []) + (["--split", split] if split else []) + [ "--dst", dst, "--query", query, DRY_RUN]
|
71 |
cmd = CMD + args
|
72 |
logs = "Job:\n\n```bash\n" + " ".join('"' + arg.replace('"', '\"""') + '"' if " " in arg else arg for arg in cmd) + "\n```\nOutput:\n\n"
|
73 |
pbars = {}
|