Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
73bca206
Commit
73bca206
authored
Feb 07, 2019
by
Remi Perenon
Browse files
Adding delay after end of a job before supressing the status file and modifying JobPlugin behaviour
parent
c535896b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Src/Core/Platform.py
View file @
73bca206
...
...
@@ -73,7 +73,17 @@ class Platform(object):
:rtype: str
'''
return
os
.
path
.
join
(
self
.
package_directory
(),
'Doc'
)
return
os
.
path
.
join
(
self
.
package_directory
(),
'Doc'
)
def
jobs_launch_delay
(
self
):
'''
Returns the delay (in seconds) for a job to launch.
This is used to determine the delay before updating the GUI and suppressing a job status file
:return: the delay (in seconds) for a job to launch
:rtype: float
'''
return
2.0
def
api_path
(
self
):
'''
...
...
Src/Framework/Jobs/JobStatus.py
View file @
73bca206
...
...
@@ -16,6 +16,8 @@ import collections
import
cPickle
import
datetime
import
os
import
threading
import
time
from
MDANSE
import
PLATFORM
from
MDANSE.Framework.Status
import
Status
...
...
@@ -47,8 +49,9 @@ class JobStatus(Status):
self
.
save_status
()
def
finish_status
(
self
):
self
.
cleanup
()
# Launch a thread that will wait before erasing the file
t
=
threading
.
Thread
(
target
=
self
.
cleanup
)
t
.
start
()
@
property
def
state
(
self
):
...
...
@@ -56,7 +59,8 @@ class JobStatus(Status):
return
self
.
_state
def
cleanup
(
self
):
# Wait before cleaning
time
.
sleep
(
PLATFORM
.
jobs_launch_delay
())
try
:
os
.
unlink
(
self
.
_state
[
'temporary_file'
])
except
:
...
...
Src/GUI/JobControllerPanel.py
View file @
73bca206
...
...
@@ -216,9 +216,12 @@ class JobControllerPanel(wx.ScrolledWindow):
event
.
Skip
()
def
msg_start_job
(
self
,
message
):
self
.
_jobsController
.
update
()
t
=
threading
.
Thread
(
target
=
self
.
updateJobsController
)
t
.
start
()
def
updateJobsController
(
self
):
time
.
sleep
(
PLATFORM
.
jobs_launch_delay
())
self
.
_jobsController
.
update
()
def
on_display_info
(
self
,
event
):
row
=
self
.
_gbSizer
.
GetItemPosition
(
event
.
GetEventObject
())[
0
]
...
...
Src/GUI/Plugins/JobPlugin.py
View file @
73bca206
...
...
@@ -113,9 +113,13 @@ class JobPlugin(ComponentPlugin):
message
=
e
.
output
else
:
message
=
None
time
.
sleep
(
1
)
PUBLISHER
.
sendMessage
(
"msg_start_job"
,
message
=
message
)
PUBLISHER
.
sendMessage
(
"msg_start_job"
,
message
=
message
)
if
message
is
None
:
d
=
wx
.
MessageDialog
(
None
,
'Your analysis is performing. Do you want to close ?'
,
'Question'
,
wx
.
YES_NO
|
wx
.
YES_DEFAULT
|
wx
.
ICON_QUESTION
)
if
d
.
ShowModal
()
==
wx
.
ID_YES
:
self
.
on_close
(
None
)
def
on_save
(
self
,
event
=
None
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment