Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lscsoft
bilby
Commits
406e17bc
Commit
406e17bc
authored
5 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Allow user-settable exit code
parent
a6608f38
No related branches found
No related tags found
1 merge request
!746
Pickle dump entire sampler in dynesty
Pipeline
#112138
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/core/sampler/dynesty.py
+5
-2
5 additions, 2 deletions
bilby/core/sampler/dynesty.py
with
5 additions
and
2 deletions
bilby/core/sampler/dynesty.py
+
5
−
2
View file @
406e17bc
...
...
@@ -78,6 +78,8 @@ class Dynesty(NestedSampler):
The number of steps to take before checking whether to check_point.
resume: bool
If true, resume run from checkpoint (if available)
exit_code: int
The code which the same exits on if it hasn
'
t finished sampling
"""
default_kwargs
=
dict
(
bound
=
'
multi
'
,
sample
=
'
rwalk
'
,
verbose
=
True
,
periodic
=
None
,
reflective
=
None
,
...
...
@@ -98,7 +100,7 @@ class Dynesty(NestedSampler):
def
__init__
(
self
,
likelihood
,
priors
,
outdir
=
'
outdir
'
,
label
=
'
label
'
,
use_ratio
=
False
,
plot
=
False
,
skip_import_verification
=
False
,
check_point
=
True
,
check_point_plot
=
True
,
n_check_point
=
None
,
check_point_delta_t
=
600
,
resume
=
True
,
**
kwargs
):
check_point_delta_t
=
600
,
resume
=
True
,
exit_code
=
130
,
**
kwargs
):
super
(
Dynesty
,
self
).
__init__
(
likelihood
=
likelihood
,
priors
=
priors
,
outdir
=
outdir
,
label
=
label
,
use_ratio
=
use_ratio
,
plot
=
plot
,
skip_import_verification
=
skip_import_verification
,
...
...
@@ -119,6 +121,7 @@ class Dynesty(NestedSampler):
self
.
resume_file
=
'
{}/{}_resume.pickle
'
.
format
(
self
.
outdir
,
self
.
label
)
self
.
sampling_time
=
datetime
.
timedelta
()
self
.
exit_code
=
exit_code
signal
.
signal
(
signal
.
SIGTERM
,
self
.
write_current_state_and_exit
)
signal
.
signal
(
signal
.
SIGINT
,
self
.
write_current_state_and_exit
)
...
...
@@ -386,7 +389,7 @@ class Dynesty(NestedSampler):
def
write_current_state_and_exit
(
self
,
signum
=
None
,
frame
=
None
):
logger
.
warning
(
"
Run terminated with signal {}
"
.
format
(
signum
))
self
.
write_current_state
()
sys
.
exit
(
130
)
os
.
_exit
(
self
.
exit_code
)
def
write_current_state
(
self
):
"""
...
...
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