Skip to content

Commit

Permalink
Working on autoprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikHogenbirk authored and ErikHogenbirk committed Feb 6, 2019
1 parent 2b1c468 commit a7b28e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ docs/_build

# coverage
.coverage

# scripts
*.e[0-9][0-9][0-9][0-9][0-9]*
*.o[0-9][0-9][0-9][0-9][0-9]*
25 changes: 24 additions & 1 deletion autoprocessing/process_run.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
version = '0.0.0'
print(f'This is process_run version {version} initializing...')

import sys
import json
import strax
import amstrax
import shutil
# import shutil
import os
from sshtunnel import SSHTunnelForwarder
import pymongo
import os


nargs = 1

if len(sys.argv) != 1 + nargs:
Expand All @@ -26,6 +31,22 @@
print(f'ERROR: could not load configuration from data/xenon/xams/processing_folder/config/{run_name}.json.')
sys.exit(2)

MONGO_HOST = "145.102.133.174"
MONGO_DB = "xamsdata0"
MONGO_USER = "xams"
if "MONGO_PASS" not in dict(os.environ).keys():
raise RuntimeError("DAQ password not set. Please define in .bashrc file. (i.e. 'export MONGO_PASS = <secret password>')")
MONGO_PASS = os.environ['MONGO_PASS']

print('Initializing server...')
server = SSHTunnelForwarder(
MONGO_HOST,
ssh_username=MONGO_USER,
ssh_password=MONGO_PASS,
remote_bind_address=('127.0.0.1', 27017)
)
server.start()
print('Server started.')

print(f'Writing to folder location {run_doc['data_folder']}')
st = strax.Context(storage=strax.DataDirectory(run_doc['data_folder']),
Expand All @@ -37,6 +58,8 @@
st.make(run_name, 'records')
print('Record building done.')



if run_doc['delete_raw_records']:
print('Deleting raw records...')
print('WARNING not implemented yet...')
Expand Down

0 comments on commit a7b28e8

Please sign in to comment.