Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pulsar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NDIP
Pulsar
Commits
ff8f888b
Commit
ff8f888b
authored
11 years ago
by
John Chilton
Browse files
Options
Downloads
Patches
Plain Diff
Improved handling of missing files.
parent
24b340bb
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lwr/framework.py
+6
-1
6 additions, 1 deletion
lwr/framework.py
lwr/lwr_client/client.py
+10
-1
10 additions, 1 deletion
lwr/lwr_client/client.py
run_client_tests.py
+6
-0
6 additions, 0 deletions
run_client_tests.py
test/app_test.py
+6
-0
6 additions, 0 deletions
test/app_test.py
with
28 additions
and
2 deletions
lwr/framework.py
+
6
−
1
View file @
ff8f888b
...
...
@@ -7,6 +7,7 @@ from webob import Response
from
webob
import
exc
import
inspect
from
os.path
import
exists
import
re
from
simplejson
import
dumps
...
...
@@ -94,7 +95,11 @@ class Controller(object):
resp
=
Response
(
body
=
dumps
(
result
))
elif
self
.
response_type
==
'
file
'
:
resp
=
Response
()
resp
.
app_iter
=
FileIterator
(
result
)
path
=
result
if
exists
(
path
):
resp
.
app_iter
=
FileIterator
(
path
)
else
:
raise
exc
.
HTTPNotFound
(
"
No file found with path %s.
"
%
path
)
else
:
resp
=
Response
(
body
=
'
OK
'
)
return
resp
(
environ
,
start_response
)
...
...
This diff is collapsed.
Click to expand it.
lwr/lwr_client/client.py
+
10
−
1
View file @
ff8f888b
...
...
@@ -19,6 +19,15 @@ class parseJson(object):
return
replacement
class
OutputNotFoundException
(
Exception
):
def
__init__
(
self
,
path
):
self
.
path
=
path
def
__str__
(
self
):
return
"
No remote output found for path %s
"
%
self
.
path
class
Client
(
object
):
"""
Objects of this client class perform low-level communication with a remote LWR server.
...
...
@@ -163,7 +172,7 @@ class Client(object):
elif
output_type
==
"
task
"
:
output_path
=
os
.
path
.
join
(
working_directory
,
name
)
else
:
raise
Exception
(
"
No remote output found for dataset with path %s
"
%
path
)
raise
OutputNotFound
Exception
(
"
No remote output found for dataset with path %s
"
%
path
)
self
.
__raw_download_output
(
name
,
self
.
job_id
,
output_type
,
output_path
)
def
__raw_download_output
(
self
,
name
,
job_id
,
output_type
,
output_path
):
...
...
This diff is collapsed.
Click to expand it.
run_client_tests.py
+
6
−
0
View file @
ff8f888b
...
...
@@ -21,6 +21,7 @@ def main():
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
'
--url
'
,
dest
=
'
url
'
,
default
=
'
http://localhost:8913/
'
)
parser
.
add_option
(
'
--private_token
'
,
default
=
None
)
parser
.
add_option
(
'
--test_errors
'
,
default
=
False
,
action
=
"
store_true
"
)
(
options
,
args
)
=
parser
.
parse_args
()
try
:
...
...
@@ -70,6 +71,11 @@ finally:
client
.
launch
(
new_command
)
client
.
wait
()
client
.
download_output
(
temp_output_path
,
temp_directory
)
if
options
.
test_errors
:
try
:
client
.
download_output
(
temp_output_path
+
"
x
"
,
temp_directory
)
except
BaseException
,
e
:
traceback
.
print_exc
(
e
)
output_file
=
open
(
temp_output_path
,
'
r
'
)
try
:
output_contents
=
output_file
.
read
()
...
...
This diff is collapsed.
Click to expand it.
test/app_test.py
+
6
−
0
View file @
ff8f888b
...
...
@@ -46,6 +46,12 @@ def test_app():
download_response
=
test_app
.
get
(
"
/download_output?job_id=%s&name=test_output
"
%
job_id
)
assert
download_response
.
body
==
"
Hello World!
"
try
:
test_app
.
get
(
"
/download_output?job_id=%s&name=test_output2
"
%
job_id
)
assert
False
# Should throw exception
except
:
pass
command_line
=
urllib
.
quote
(
"""
python -c
"
import sys; sys.stdout.write(
'
test_out
'
)
"
"""
)
launch_response
=
test_app
.
get
(
"
/launch?job_id=%s&command_line=%s
"
%
(
job_id
,
command_line
))
assert
launch_response
.
body
==
'
OK
'
...
...
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