Merge branch 'master' of https://gitlab.psi.ch/bec/csaxs-bec
This commit is contained in:
@@ -9,7 +9,9 @@ from bec_lib.core.file_utils import FileWriterMixin
|
||||
class csaxs_archiver:
|
||||
"""Class to archive data from a beamtime.
|
||||
To run this script from a shell, go to discovery.psi.ch and copy your token.
|
||||
Afterwards, get a Keberos token (kinit) for yourself in the shell that you run this code.
|
||||
Complement the information in user_input below in the if __name__ == __main__ part of the script.
|
||||
Afterwards, get a Keberos token (kinit) for yourself in the shell.
|
||||
Activate the bec_venv by doing "source bec_venv/bin/activate" and then run this code via python $filename.
|
||||
As a last step, adjust the dictionary below in if __name__ == '__main__' with your token as well as information about the experiment
|
||||
"""
|
||||
|
||||
@@ -125,8 +127,9 @@ class csaxs_archiver:
|
||||
command = f'datasetIngestor -allowexistingsource -ingest -autoarchive -noninteractive -token {self.token} {self.metadata_file} {self.datafile_name}'
|
||||
rtr = os.popen(command)
|
||||
|
||||
with open(os.path.join(fname,'_log.txt'), "w") as file:
|
||||
file.write(rtr.read())
|
||||
#with open(os.path.join(fname,'_log.txt'), "w") as file:
|
||||
# print(f'Writing reponse to file')
|
||||
# file.write(rtr.read())
|
||||
# result = subprocess.run(command, shell=False, stdout = subprocess.PIPE, stderr = subprocess.PIPE, universal_newlines=True)
|
||||
# if result.returncode == 0:
|
||||
# print(f"Command {command} was succesful")
|
||||
@@ -138,10 +141,13 @@ if __name__ == "__main__":
|
||||
# Generate dictionary with user input.
|
||||
user_input = {
|
||||
"base_path": "~/Data10",
|
||||
"eacc": "e20639",
|
||||
"eacc": "e20643",
|
||||
"pi": "Marianne Liebi",
|
||||
"pi_email": "marianne.liebi@psi.ch",
|
||||
'log_path' : '~/Data10/documentation/ingestion_logs/'
|
||||
'log_path' : '~/Data10/documentation/ingestion_logs/',
|
||||
'token' : '',
|
||||
'start_scan' : 0,
|
||||
'stop_scan' : 0,
|
||||
}
|
||||
archiver = csaxs_archiver(start_scan=10, stop_scan=20, token='', **user_input)
|
||||
archiver = csaxs_archiver(**user_input)
|
||||
archiver.run_for_all_scans()
|
||||
|
||||
Reference in New Issue
Block a user