Commit cbf6fca0 authored by Jungho Shin's avatar Jungho Shin

adding checksum

parent cde1d1ff
......@@ -20,7 +20,7 @@ def calculateTags(inputDict, backend, calcUri):
repo_dic_sub_out = repo_dic_sub.communicate(inputDict_str.encode('utf-8'))[0]
repo_dic = json.loads(repo_dic_sub_out.decode("utf-8"))
#backend.addValue("repository_checksum", repo_dic['checksum'])
backend.addValue("repository_checksum", repo_dic['checksum'])
backend.addValue("repository_chemical_formula", repo_dic['formula'])
backend.addValue("repository_parser_id", repo_dic['prog_name'] + ' v1.0')
backend.addValue("repository_atomic_elements", repo_dic['elements'])
......@@ -55,8 +55,8 @@ def main():
calcUri,
parserInfo = {'name':'RepoTagsNormalizer', 'version': '1.0'})
#dictReader=ParseStreamedDicts(sys.stdin)
dictReader=ParseStreamedDicts(open("/u/jungho/myscratch/nomad-lab-base/normalizers/repo-tags/test/examples/scalaOut2.txt", 'r'))
dictReader=ParseStreamedDicts(sys.stdin)
#dictReader=ParseStreamedDicts(open("/u/jungho/myscratch/nomad-lab-base/normalizers/repo-tags/test/examples/scalaOut2.txt", 'r'))
while True:
inputDict=dictReader.readNextDict()
......
#import setup_paths, setup_paths_repo
import sys, json
import sqlalchemy
base_path= sys.exec_prefix + '/python'
sys.path.insert(0, base_path)
from nomadrepo.core.settings import connect_database, settings
from nomadrepo.core.api import API
inputStr = sys.stdin.readline()
def extract_metadata(dic):
def extract_metadata(dic_in):
session = connect_database(settings, None)()
checksum = session.execute("SELECT checksum FROM calculations WHERE calc_id = %d ;" % 4000000).fetchone()[0]
session.commit(); session.close()
work = API()
for calc, error in work._parse(dic, "normalizerRepo"):
for calc, error in work._parse(dic_in, "normalizerRepo"):
calc, error = work.classify(calc)
calc.info['oadate'] = None
#calc.info['checksum'] = calc.get_checksum()
calc.info['checksum'] = str(checksum)
json.dump(calc.info, sys.__stdout__)
pass
def main():
inputStr = sys.stdin.readline()
inputDict = json.loads(inputStr)
extract_metadata(inputDict)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment