Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Palmer
VTK
Commits
726584b4
Commit
726584b4
authored
10 years ago
by
Sebastien Jourdain
Committed by
Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge topic 'vtkweb-python-fix' into master
4c98d894
Fix python for vtkweb
parents
cb1f8939
4c98d894
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Web/Python/launcher.py
+19
-15
19 additions, 15 deletions
Web/Python/launcher.py
Web/Python/server.py
+1
-1
1 addition, 1 deletion
Web/Python/server.py
with
20 additions
and
16 deletions
Web/Python/launcher.py
+
19
−
15
View file @
726584b4
...
...
@@ -43,7 +43,7 @@ Here is a sample of what a configuration file could looks like:
"
content
"
:
"
/.../www
"
, # Optional: Directory shared over HTTP
"
proxy_file
"
:
"
/.../proxy-mapping.txt
"
, # Proxy-Mapping file for Apache
"
sessionURL
"
:
"
ws://${host}:${port}/ws
"
, # ws url used by the client to connect to the started process
"
timeout
"
: 5,
# Wait time in second after process start
"
timeout
"
:
2
5, # Wait time in second after process start
"
log_dir
"
:
"
/.../viz-logs
"
, # Directory for log files
"
upload_dir
"
:
"
/.../data
"
, # If launcher should act as upload server, where to put files
"
fields
"
: [
"
file
"
,
"
host
"
,
"
port
"
,
"
updir
"
] # List of fields that should be send back to client
...
...
@@ -53,7 +53,7 @@ Here is a sample of what a configuration file could looks like:
## Useful session vars for client
## ===============================
"
sessionData
"
: { updir
"
:
"
/Home
"
}
# Tells client which path to updateFileBrowser after uploads
"
sessionData
"
: {
"
updir
"
:
"
/Home
"
}
,
# Tells client which path to updateFileBrowser after uploads
## ===============================
## Resources list for applications
...
...
@@ -323,15 +323,19 @@ class ProcessManager(object):
# ========================================================================
# Look for ready line in process output. Return True if found, False
# otherwise. If no ready_line is configured and process is running return
#
Tru
e.
#
False. This will then rely on the timout tim
e.
# ========================================================================
def
isReady
(
self
,
session
):
def
isReady
(
self
,
session
,
count
=
0
):
id
=
session
[
'
id
'
]
# The process has to be running to be ready!
if
not
self
.
isRunning
(
id
)
and
count
<
60
:
return
False
# Give up after 60 seconds if still not running
if
not
self
.
isRunning
(
id
):
return
Fals
e
return
Tru
e
application
=
self
.
config
[
'
apps
'
][
session
[
'
application
'
]]
ready_line
=
application
.
get
(
'
ready_line
'
,
None
)
...
...
@@ -339,7 +343,7 @@ class ProcessManager(object):
# If no ready_line is configured and the process is running then thats
# enough.
if
not
ready_line
:
return
Tru
e
return
Fals
e
ready
=
False
...
...
@@ -422,11 +426,11 @@ class LauncherResource(resource.Resource, object):
# If a ready_line is configured create a Deferred object to wait for
# ready line to be produced
if
'
ready_line
'
in
self
.
_config
[
'
apps
'
][
session
[
'
application
'
]]:
ready_deferred
=
self
.
_waitForReady
(
session
,
request
)
ready_deferred
.
addCallback
(
self
.
_delayedRenderReady
,
session
)
ready_deferred
.
addErrback
(
errback
)
# Make sure other deferred is canceled once one has been fired
request
.
notifyFinish
().
addCallback
(
lambda
x
:
ready_deferred
.
cancel
())
ready_deferred
=
self
.
_waitForReady
(
session
,
request
)
ready_deferred
.
addCallback
(
self
.
_delayedRenderReady
,
session
)
ready_deferred
.
addErrback
(
errback
)
# Make sure other deferred is canceled once one has been fired
request
.
notifyFinish
().
addCallback
(
lambda
x
:
ready_deferred
.
cancel
())
return
NOT_DONE_YET
...
...
@@ -437,12 +441,12 @@ class LauncherResource(resource.Resource, object):
# be triggered when the session is ready
# ========================================================================
def
_waitForReady
(
self
,
session
,
request
,
d
=
None
):
def
_waitForReady
(
self
,
session
,
request
,
count
=
0
,
d
=
None
):
if
not
d
:
d
=
defer
.
Deferred
()
if
not
self
.
process_manager
.
isReady
(
session
):
reactor
.
callLater
(
1
,
self
.
_waitForReady
,
session
,
request
,
d
)
if
not
self
.
process_manager
.
isReady
(
session
,
count
+
1
):
reactor
.
callLater
(
1
,
self
.
_waitForReady
,
session
,
request
,
count
+
1
,
d
)
else
:
d
.
callback
(
request
)
...
...
@@ -454,7 +458,7 @@ class LauncherResource(resource.Resource, object):
# ========================================================================
def
_delayedRenderTimeout
(
self
,
request
,
session
):
ready
=
self
.
process_manager
.
isReady
(
session
)
ready
=
self
.
process_manager
.
isReady
(
session
,
0
)
if
ready
:
request
.
write
(
json
.
dumps
(
filterResponse
(
session
,
self
.
field_filter
)))
...
...
This diff is collapsed.
Click to expand it.
Web/Python/server.py
+
1
−
1
View file @
726584b4
...
...
@@ -10,7 +10,7 @@ Use "--help" to list the supported arguments.
"""
import
sys
import
sys
,
logging
from
.
import
testing
from
.
import
upload
...
...
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