Skip to content
Snippets Groups Projects
Commit 433badf4 authored by Janet Goldstein's avatar Janet Goldstein
Browse files

Core sampler: don't leave a DB connection out there flapping in the breeze

parent a3ce86a5
No related branches found
No related tags found
1 merge request!667Core sampler: don't leave a DB connection out there flapping in the breeze
Pipeline #3720 passed
......@@ -188,11 +188,16 @@ def main():
action="store",
)
ns = parser.parse_args()
if ns.project_code:
CoreSampler(MDDBConnector()).sample_project(ns.project_code[0])
elif ns.sdm_name:
CoreSampler(MDDBConnector()).sample_eb(ns.sdm_name[0])
conn = MDDBConnector()
sampler = CoreSampler(conn)
try:
if ns.project_code:
sampler.sample_project(ns.project_code[0])
elif ns.sdm_name:
sampler.sample_eb(ns.sdm_name[0])
finally:
conn.close()
return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment