Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Strand Lab
Strand Lab Cellxgene Gateway
Commits
f7f49b35
Commit
f7f49b35
authored
Sep 17, 2019
by
Alok Saldanha
Browse files
#2 added link to relaunch server on process error page
parent
a6d80c19
Changes
8
Hide whitespace changes
Inline
Side-by-side
cellxgene_gateway/cache_entry.py
View file @
f7f49b35
...
...
@@ -6,6 +6,7 @@
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, either express or implied. See the License for
# the specific language governing permissions and limitations under the License.
import
psutil
from
flask
import
make_response
,
request
from
requests
import
get
,
post
,
put
...
...
@@ -73,7 +74,8 @@ class CacheEntry:
else
:
self
.
all_output
+=
output
def
terminate
(
self
,
process
):
def
terminate
(
self
):
pid
=
self
.
pid
if
pid
!=
None
and
self
.
status
!=
"terminated"
:
p
=
psutil
.
Process
(
pid
)
p
.
terminate
()
...
...
cellxgene_gateway/gateway.py
View file @
f7f49b35
...
...
@@ -48,6 +48,7 @@ def handle_invalid_usage(error):
"cellxgene_error.html"
,
extra_scripts
=
get_extra_scripts
(),
message
=
message
,
path
=
error
.
path
),
error
.
http_status
,
)
...
...
@@ -67,7 +68,11 @@ def handle_invalid_process(error):
render_template
(
"process_error.html"
,
extra_scripts
=
get_extra_scripts
(),
message
=
message
,
message
=
error
.
message
,
http_status
=
error
.
http_status
,
stdout
=
error
.
stdout
,
stderr
=
error
.
stderr
,
dataset
=
error
.
dataset
,
),
error
.
http_status
,
)
...
...
@@ -180,7 +185,7 @@ def do_view(path):
"loading.html"
,
launchtime
=
launch_time
,
all_output
=
match
.
all_output
)
elif
match
.
status
==
"error"
:
raise
ProcessException
.
from_
pid_object
(
match
)
raise
ProcessException
.
from_
cache_entry
(
match
)
@
app
.
route
(
"/cache_status"
,
methods
=
[
"GET"
])
def
do_GET_status
():
...
...
@@ -195,7 +200,7 @@ def do_relaunch(path):
match
=
cache
.
check_entry
(
dataset
)
if
not
match
is
None
:
match
.
terminate
()
return
redirect
(
url_for
(
'view'
,
path
=
path
),
code
=
30
1
)
return
redirect
(
url_for
(
'
do_
view'
,
path
=
path
),
code
=
30
2
)
def
main
():
env
.
validate
()
...
...
cellxgene_gateway/process_exception.py
View file @
f7f49b35
...
...
@@ -9,18 +9,20 @@
class
ProcessException
(
Exception
):
def
__init__
(
self
,
message
,
stdout
,
stderr
,
http_status
):
def
__init__
(
self
,
message
,
stdout
,
stderr
,
http_status
,
dataset
):
Exception
.
__init__
(
self
)
self
.
message
=
message
self
.
stdout
=
stdout
self
.
stderr
=
stderr
self
.
http_status
=
http_status
self
.
dataset
=
dataset
@
classmethod
def
from_
pid_object
(
cls
,
pid_object
):
def
from_
cache_entry
(
cls
,
cache_entry
):
return
cls
(
pid_object
.
message
,
pid_object
.
all_output
,
pid_object
.
stderr
,
pid_object
.
http_status
,
cache_entry
.
message
,
cache_entry
.
all_output
,
cache_entry
.
stderr
,
cache_entry
.
http_status
,
cache_entry
.
dataset
,
)
cellxgene_gateway/prune_process_cache.py
View file @
f7f49b35
...
...
@@ -9,8 +9,6 @@
import
time
import
psutil
from
cellxgene_gateway.util
import
current_time_stamp
from
cellxgene_gateway.env
import
ttl
...
...
cellxgene_gateway/subprocess_backend.py
View file @
f7f49b35
...
...
@@ -62,7 +62,7 @@ class SubprocessBackend:
cache_entry
.
status
=
"error"
cache_entry
.
set_error
(
message
,
stderr
,
http_status
)
raise
ProcessException
.
from_
pid_object
(
cache_entry
)
raise
ProcessException
.
from_
cache_entry
(
cache_entry
)
else
:
cache_entry
.
append_output
(
output
)
...
...
cellxgene_gateway/templates/cache_status.html
View file @
f7f49b35
...
...
@@ -31,7 +31,7 @@
<th>
dataset
</th>
<th>
port
</th>
<th>
launchtime
</th>
<th>
timestamp
</th>
<th>
last access
</th>
<th>
status
</th>
<th>
message
</th>
<th>
http_status
</th>
...
...
@@ -43,8 +43,8 @@
<td>
{{ entry.pid }}
</td>
<td>
{{ entry.dataset }}
</td>
<td>
{{ entry.port }}
</td>
<td>
{{ entry.launchtime }}
</td>
<td>
{{ entry.timestamp }}
</td>
<td
class=
"timestamp"
>
{{ entry.launchtime }}
</td>
<td
class=
"timestamp"
>
{{ entry.timestamp }}
</td>
<td>
{{ entry.status }}
</td>
<td>
{{ entry.message }}
</td>
<td>
{{ entry.http_status }}
</td>
...
...
@@ -52,5 +52,15 @@
{% endfor %}
</tbody>
</table>
<script>
$
(()
=>
{
$
(
"
.timestamp
"
).
each
(
function
(){
const
el
=
$
(
this
);
const
ts
=
el
.
text
();
const
dt
=
new
Date
(
parseInt
(
ts
*
1000
));
el
.
html
(
`
${
dt
.
toISOString
()}
<br>(
${
ts
}
)`
);
});
})
</script>
</body>
</html>
cellxgene_gateway/templates/index.html
View file @
f7f49b35
...
...
@@ -39,6 +39,11 @@
<u>
File Crawler: Allows you to view all uploaded data.
</u></a>
</div>
<div
class=
"list-group"
style=
"width:50%;padding-left:65px"
>
<a
href=
"/cache_status"
class=
"list-group-item list-group-item-action"
>
<u>
Cache Status: view status of launched cellxgene servers.
</u></a>
</div>
<br>
<h1
style=
"padding-left:35px"
>
...
...
@@ -103,9 +108,5 @@ scp -r pbmc3k.h5ad ec2-user@{{ ip }}:{{ cellxgene_data }}/USER/DATA/</pre>
<li>
Take a look at your data using the file crawler link above
</li>
</ol>
<ul>
<li><a
href=
"/cache_status.html"
>
Cache Status
<
</
a
>
- view status of currently loaded datasets
</li>
</ul>
</body>
</html>
cellxgene_gateway/templates/process_error.html
View file @
f7f49b35
...
...
@@ -25,19 +25,27 @@
</header>
<br>
<div
style=
"margin-left:20px"
>
<h4>
{{ message[0] }}
</h4>
<h4>
{{ message[1] }}
</h4>
<h4>
{{ message[2] }}
</h4>
<h4>
{{ message[3] }}
</h4>
<a
href=
"/filecrawl.html"
>
Please click here to be redirected to the file directory.
</a>
<br>
<a
href=
"/"
>
Please click here to return to the homepage.
</a>
</div>
<h4>
Error Details
</h4>
<table>
<tr><th>
Message
</th><td>
{{ message }}
</td></tr>
<tr><th>
Status
</th><td>
{{ http_status }}
</td></tr>
<tr><th>
Stdout
</th><td>
{{ stdout }}
</td></tr>
<tr><th>
Stderr
</th><td>
{{ stderr }}
</td></tr>
</table>
<br>
<h4>
Options
</h4>
Please choose one of the following, or use the back button:
<ul>
<li><a
href=
"{{url_for('do_relaunch', path=dataset)}}"
>
Attempt to relaunch the cellxgene server.
</a></li>
<li><a
href=
"/filecrawl.html"
>
Return to the file directory.
</a></li>
<li><a
href=
"/"
>
Return to the homepage.
</a></li>
</ul>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment