Пример #1
0
                            tmp_norm_sid][user_define_attr]
                    else:
                        tmp_group_arr += 0
                tmp_date_arr += str(tmp_group_arr) + '\t'
            if self.date_sid_dic.get(tmp_norm_date):
                self.date_sid_dic[tmp_norm_date] += '\t' + tmp_date_arr[:-1]
            else:
                self.date_sid_dic[tmp_norm_date] = tmp_date_arr[:-1]


if __name__ == '__main__':
    sid_dic = {}
    flag = 2
    query = ''
    reducer_merge_init = reducer_merge()
    mapper.init()
    norms = []
    groups_dic = {}
    for tmp_value in mapper.WORKER.norm:
        tmp_norm = tmp_value.split(':')[0]
        norms.append(tmp_norm)
        groups = []
        for tmp_group in tmp_value.split(':')[1].split('vs'):
            sid_group = tmp_group.split('_')
            groups.append(sid_group)
        groups_dic[tmp_norm] = groups
    for line in sys.stdin:
        search_list = line.strip().split('\t')
        if MAP_DIC[search_list[0]] == 0:
            flag = 0
            reducer_merge_init.sid_dim(search_list, mapper.KEYS, mapper.KVS)
#!/usr/bin/env python

import c3_cloud
import os
import mapper
import signal
from pathlib import Path

if __name__ == '__main__':
    if Path("./.pid").is_file():
        f = open("./.pid", "r")
        pid = int(f.readline())
        try:
            os.kill(pid, signal.SIGTERM)
        except OSError:
            print("info: no running instance found.")
        else:
            print(
                "info: Quitting running c3_cloud semantic mapper instance (pid {})..."
                .format(pid))
    else:
        print("info: no .pid file found.")

    print("creating database...")
    mapper.init(recreate_database=True)
    print("database rebuilt.")
    print("launching new semantic mapper instance...")
    c3_cloud.run()