Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Test as a Service Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INS Courses
AutPy
Test as a Service Client
Commits
267f3165
Commit
267f3165
authored
3 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Add some more debugging info and safeguards
parent
47cb77c1
No related branches found
No related tags found
1 merge request
!2
Add some more debugging info and safeguards
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
taas_client/cli.py
+13
-2
13 additions, 2 deletions
taas_client/cli.py
with
13 additions
and
2 deletions
taas_client/cli.py
+
13
−
2
View file @
267f3165
from
logging
import
error
import
datetime
import
time
import
sys
from
click.termui
import
style
...
...
@@ -24,6 +25,13 @@ def upload_file(
),
url
:
str
=
typer
.
Argument
(
"
http://localhost:5000/testbook
"
,
envvar
=
"
TAAS_URL
"
),
):
if
not
notebook
.
is_relative_to
(
Path
.
home
()
/
'
work
'
/
'
AutPy
'
):
console
.
print
(
f
"
[red]Refusing to submit file from unexpected location[/]:
{
notebook
}
\n
"
"
Make sure you
'
re not accidentally working in the
'
Originale
'
folder!
"
)
raise
typer
.
Exit
(
code
=
1
)
modified
=
round
(
time
.
time
()
-
notebook
.
stat
().
st_mtime
)
sec
=
'
second
'
if
modified
==
1
else
'
seconds
'
suffix
=
'
, [red]make sure you saved![/]
'
if
modified
>=
10
else
''
...
...
@@ -66,12 +74,15 @@ def upload_file(
try
:
print
(
f
"
[red]Error:
{
exc
.
response
.
json
().
get
(
'
error
'
)
}
[/]
"
,
file
=
sys
.
stderr
)
print
(
f
"
[red]Message:
{
exc
.
response
.
json
().
get
(
'
msg
'
)
}
[/]
"
,
file
=
sys
.
stderr
)
print
(
"
:boom: [bold]Submission failed![/]
"
)
timestamp
=
datetime
.
datetime
.
now
().
strftime
(
'
%Y-%m-%d %H:%M:%S
'
)
print
(
f
"
:boom: [bold]Submission failed![/] [white](
{
timestamp
}
)[/]
"
)
except
:
pass
raise
typer
.
Exit
(
code
=
1
)
print
(
"
:mailbox: :heavy_check_mark: [bold]Submission successful![/]
"
)
commit
=
result
.
get
(
"
commit
"
,
"
?
"
)
timestamp
=
datetime
.
datetime
.
now
().
strftime
(
'
%Y-%m-%d %H:%M:%S
'
)
print
(
f
"
:mailbox: :heavy_check_mark: [bold]Submission successful![/] [white](
{
timestamp
}
,
{
commit
}
)[/]
"
)
def
run
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment