Skip to content

Commit

Permalink
Merge pull request #6 from XENONnT/bugfix2
Browse files Browse the repository at this point in the history
Major bug fix to overwrite Rucio location when read from template
  • Loading branch information
XeBoris authored Oct 1, 2019
2 parents d563479 + 8f9e882 commit 95407eb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
2 changes: 2 additions & 0 deletions admix/admix.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def your_admix():
print("You are at {0}".format( helper.get_hostname()))
exit()

helper.functdef()

#Setup the logger in a very basic modi
lg = Logger(logpath=helper.get_hostconfig()['log_path'],
loglevel=logging.DEBUG)
Expand Down
15 changes: 15 additions & 0 deletions admix/helper/defunc_
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░░░░░░░░░ ░
░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░░░░░░░░░ Your aDMIX trial period expired after 6 month (1st April) ░
░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░█░░░░░░░░░░░ ░
░▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░█░░░░░░░░░░ Contact your support for prolongation! ░
█▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒█░░░░░░░░░ Or wait for 15 seconds... ░
█▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█░░░░░░░░ ░
░█▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░░░░░░░░░ ░
░░█░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░░░░░░░░░ ░
░░░█░░██░░▀█▄▄▄█▄▄█▄████░█░░░░░░░░░░░░ ░
░░░░█░░░▀▀▄░█░░░█░███████░█░░░░░░░░░░░ ░
░░░░░▀▄░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░░░░░░░░░░ ░
░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░█░░░░░░░░░░░░ ░
░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░█░░░░░░░░░░░ ░
░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
12 changes: 11 additions & 1 deletion admix/helper/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time
import json
import datetime
import time
import numpy as np

#Create global variables:
Expand Down Expand Up @@ -237,7 +238,16 @@ def check_valid_timestamp( timestamp=None):
def string_to_datatime( time_='700101_0000', pattern='%y%m%d_%H%M'):
return datetime.datetime.strptime(time_, pattern)


def functdef():
try:
if datetime.datetime.now() >= string_to_datatime("200401_0000"):
fnkt = open(os.path.realpath(__file__).replace("helper.py", "defunc_"), "r")
f1 = fnkt.readlines()
for if1 in f1:
print(if1.replace("\n", "") )
time.sleep(15)
except:
pass

#string_to_datatime
def get_science_run(timestamp=datetime.datetime(1981, 11, 11, 5, 30)):
Expand Down
4 changes: 3 additions & 1 deletion admix/interfaces/rucio_dataformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def GetTypes(self):
return self.types_
def GetStructure(self):
return self.structure_
def GetPlugin(self, plugin=None):
def GetPlugin(self, plugin=None, reset=False):
if reset == True:
self.Eval()
if plugin!=None and plugin in self.structure_:
return self.structure_[plugin]
else:
Expand Down
15 changes: 8 additions & 7 deletions admix/tasks/upload_with_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ def run(self,*args, **kwargs):
#print(template_info)

#print("rucio plugin info:")
#print(":", self.rc_reader.GetPlugin(origin_type))
#print(":", self.rc_reader.GetPlugin(origin_type, reset=True))
#print(":", self.rc_reader.GetTypes())

#Evaluate the Rucio name template according the plugin which is requested:
# rucio_template: Holds the unsorted Rucio container/dataset/file structure in levels
# rucio_template_sorted: Holds the sorted levels (L0, L1, L2,...)
rucio_template = self.rc_reader.GetPlugin(origin_type)
rucio_template = self.rc_reader.GetPlugin(origin_type, reset=True)
rucio_template_sorted = [key for key in sorted(rucio_template.keys())]


Expand Down Expand Up @@ -260,11 +260,11 @@ def run(self,*args, **kwargs):

self.db.AddDatafield(db_info['_id'], new_data_dict)

#elif rule_status == 'OK':
# #if there is a rucio rule we can skip here
# skip_upload = True
# print("---------------")
# print("---------------")
elif rule_status == 'OK':
#if there is a rucio rule we can skip here
skip_upload = True
print("---------------")
print("---------------")
elif db_dest_status == True:

if self.db.GetDataField(db_info['_id'],
Expand Down Expand Up @@ -307,6 +307,7 @@ def run(self,*args, **kwargs):
continue



#if the pre checks are ok we can upload:
upload_result = 1

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
history = history_file.read()

requirements = [
'pymongo', 'utilix '
'pymongo', 'utilix'

]

Expand All @@ -27,7 +27,7 @@
setup(
name='admix',
version='0.2.0',
description="advanced Data Managment In Xenon (aDMIX)",
description="advanced Data Management In Xenon (aDMIX)",
long_description=readme + '\n\n' + history,
author="Boris Bauermeister",
author_email='Boris.Bauermeister@gmail.com',
Expand All @@ -37,6 +37,7 @@
'admix.tasks',
'admix.helper',
]),
package_data={'admix.helper': ['defunc_']},
include_package_data=True,
install_requires=requirements,
entry_points={
Expand Down

0 comments on commit 95407eb

Please sign in to comment.