コード例 #1
0
def data():
    if request.method == 'GET':
        pass
    else:
        user_id = session.get('user_id')
        source_path = request.form.get('selectsource')
        select_rule = request.form.get('selectrule')
        data = pd.read_excel(source_path)
        if 'Unnamed' in ','.join(data.columns):
            data = pd.read_excel(source_path, skiprows = range(0, 6))
        # titles = ['PR_ID','CustomerImpact','BBU','RRU','Category','Opendays','ReportCW','CloseCW','CrossCount','Duplicated','AttachPR','TestState','Severity','Top','Release','Comments']
        stat = pd.DataFrame()
        rule = Rule.query.filter(Rule.id == select_rule).first()
        static = Static(data, rule)
        stat = static.static()
        stat_orderdict = stat.to_dict(into=OrderedDict)
        static_data = Static_Data(data=str(stat_orderdict))
        user = User.query.filter(User.id == user_id).first()
        static_data.owner = user
        static_data.use_rule = rule
        db.session.add(static_data)
        db.session.commit()
        # qqqqq = Static_Data.query.order_by(desc(Static_Data.id)).first()
        # ccc = pd.DataFrame(eval(qqqqq.data.replace('nan','np.nan')))
        return render_template('data.html',stat=stat)
コード例 #2
0
    def update_minikube_in_hosts(self):
        self.get_minikube_ip()

        name = "Update minikube.local to /etc/hosts"
        cmd = "sed -i -e $'s/.*minikube.*/{0}\tminikube.local registry.minikube.local elasticsearch.minikube.local kibana.minikube.local  kafka.minikube.local rest.kafka.minikube.local grafana.minikube.local flink.minikube.local neo4j.minikube.local/' /etc/hosts".format(
            self.settings.master_ip)
        Static.msg(name, '.')
        Cmd.local_sudo_prompt_run(name, cmd)
コード例 #3
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
 def registry_port_forward_enable(self):
     name = "Enable PortForward to Registy"
     cmd = "kubectl port-forward --namespace kube-system {0} 5000:5000 & echo $$! > {1}/port-forward.pid".format(
         self.settings.folder_user_populated, self.get_registry_pod())
     master_node = Cmd.local_run_get_out(name, cmd)
     Static.msg(name, master_node)
     Static.msg(">", cmd)
     return master_node
コード例 #4
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
    def taint_add_to_master_noschedule(self):

        name = "Add Taint Master. No Schedule"
        master_node = self.get_master_node()
        cmd = "kubectl taint nodes {0} node-role.kubernetes.io/master=:NoSchedule".format(
            master_node)
        Static.msg(name, master_node)
        Cmd.local_run_long(name, cmd)
コード例 #5
0
    def add_minikube_to_hosts(self):
        self.get_minikube_ip()

        name = "Add minikube.local to /etc/hosts"
        cmd = "bash -c \"echo $'{0}\tminikube.local registry.minikube.local elasticsearch.minikube.local kibana.minikube.local kafka.minikube.local rest.kafka.minikube.local grafana.minikube.local flink.minikube.local neo4j.minikube.local' >> /etc/hosts\"".format(
            self.settings.master_ip)
        Static.msg(name, '.')
        Cmd.local_sudo_prompt_run(name, cmd)
コード例 #6
0
 def destroy(self):
     Static.figletcyber("DESTROY CLUSTER")
     if self.settings.provision.cloud == "aws":
         self.kops.destroy_cluster()
     elif self.settings.provision.cloud == "minikube":
         self.minikube.delete()
     else:
         Static.msg_bold("No such provisioner specified in config", self.settings.provision.cloud)
         raise SystemExit(32)
コード例 #7
0
 def mini_hostname(self):
     Static.figletcyber("HOSTNAME")
     if self.minikube.is_minikube_in_hosts():
         # replace, exists
         self.minikube.update_minikube_in_hosts()
     else:
         # append, new
         self.minikube.add_minikube_to_hosts()
     Static.msg("/etc/hosts entry for minikube.local updated to", self.settings.master_ip)
コード例 #8
0
ファイル: elements.py プロジェクト: aland-zhang/cli-1
    def kubectl_install_elements(self, stage):
        name = "ELEMENTS"
        Static.figletcyber('{0} {1}'.format(name, stage.upper()))

        self.CmdKubectl.get_master_ip()
        self.CmdKubectl.get_ingress_ips()

        for element in self.settings.elements[stage]:
            self.create_stage(element)
コード例 #9
0
 def check_alive(self):
     Static.figletcyber("STATUS")
     # not implemented
     if self.settings.provision.cloud == "aws":
         pass
     elif self.settings.provision.cloud == "minikube":
         pass
     else:
         Static.msg_bold("No such provisioner specified in config", self.settings.provision.cloud)
         raise SystemExit(32)
コード例 #10
0
 def get_domain(self):
     domain_queue = Queue(-1)
     i = 1
     while i <= DOMAIN_SOURCE_TABLE_NUM:
         for domain in Static.whois_db.get_not_deal_domains(
                 i, Static.FINISHED_TLD):
             domain_queue.put(domain)
         i += 1
     print Static.get_now_time(), '提取出域名: ', domain_queue.qsize()
     return domain_queue
コード例 #11
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
    def destroy_cluster(self):
        name = "DESTROY CLUSTER"
        Static.figletcyber(name)

        cmd = "kops delete cluster --state={0} {1} --yes".format(
            self.settings.provision.s3_store,
            self.settings.provision.domain
        )
        Static.msg(name, "KOPS: aws")
        Cmd.local_run_realtime_continue_on_fail(name, cmd)
コード例 #12
0
ファイル: scene.py プロジェクト: Capprin/drawing-games
    def add_type(self,
                 name,
                 drawn_type=None,
                 res_asset_path=None,
                 full_asset_path=None,
                 meta_path=None):
        # make asset path safe
        if res_asset_path is not None:
            res_asset_path = res_asset_path.replace('\\', '/')

        add_type = DrawnType(name,
                             start_ext_id=self.curr_ext_resource_id,
                             start_sub_id=self.curr_sub_resource_id)
        # break out for specific node types
        if drawn_type is not None and drawn_type in self.TYPES:
            if drawn_type == 'sprite':
                add_type = Sprite(name,
                                  res_asset_path,
                                  meta_path=meta_path,
                                  start_ext_id=self.curr_ext_resource_id,
                                  start_sub_id=self.curr_sub_resource_id)
            elif drawn_type == 'static':
                add_type = Static(name,
                                  res_asset_path,
                                  full_asset_path,
                                  self.curr_ext_resource_id,
                                  self.curr_sub_resource_id,
                                  meta_path=meta_path)
            elif drawn_type == 'platforms':
                add_type = Static(name,
                                  res_asset_path,
                                  full_asset_path,
                                  self.curr_ext_resource_id,
                                  self.curr_sub_resource_id,
                                  meta_path=meta_path,
                                  one_way=True)
            elif drawn_type == 'physics' or drawn_type == 'items':
                add_type = Physics(name, res_asset_path, meta_path,
                                   self.curr_ext_resource_id,
                                   self.curr_sub_resource_id)
        elif res_asset_path is not None:
            # use sprites, if asset path exists
            add_type = Sprite(name,
                              res_asset_path,
                              meta_path=meta_path,
                              start_ext_id=self.curr_ext_resource_id,
                              start_sub_id=self.curr_sub_resource_id)

        # add node, external, sub content
        self.nodes += add_type.get_node_string() + '\n'
        self.ext_resources += add_type.get_ext_resources_string()
        self.sub_resources += add_type.get_sub_resources_string()
        # update id's
        self.curr_ext_resource_id = add_type.get_last_ext_id()
        self.curr_sub_resource_id = add_type.get_last_sub_id()
コード例 #13
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
    def add_instance_group(self, ig):
        name = "ADD INSTANCE GROUP"
        Static.figletcyber(name)

        cmd = "kops create ig {0} --state={1} {2}".format(
            ig.name,
            self.settings.provision.s3_store,
            self.settings.provision.domain
        )
        Static.msg(name, "KOPS: aws")
        Cmd.local_run_long(name, cmd)
コード例 #14
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
    def taint_remove_from_master(self):

        name = "Remove Taint Master"
        master_node = self.get_master_node()
        cmd = "kubectl taint nodes {0} node-role.kubernetes.io/master-".format(
            master_node)
        Static.msg(name, master_node)
        try:
            Cmd.local_run_long(name, cmd)
        except:
            pass
コード例 #15
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
 def validate_cluster(self):
     name = "VALIDATE CLUSTER"
     task = "Validate Provisioned Cluster"
     cmd = "kops validate cluster --name={0} --state={1} -v={2} 2>&1".format(
         self.settings.provision.domain,
         self.settings.provision.s3_store,
         self.settings.provision.kops_verbosity
     )
     print cmd
     Cmd.local_run_long_until_success(name, cmd)
     Static.msg("Provisioning of Kubernetes Cluster", "VERIFIED")
コード例 #16
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
    def get_ingress_ips(self):
        name = "Get Ingress IPs"
        if self.get_context() == "minikube":
            cmd = "minikube ip"
            self.settings.ingress_ips.append(self.settings.master_ip)
        else:
            self.settings.ingress_ips = self.get_ig_ips(
                self.settings.cluster.ingress_instance_group)

        Static.msg(name, self.settings.ingress_ips)
        return self.settings.ingress_ips
コード例 #17
0
ファイル: cmd.py プロジェクト: christinataft/cli
    def local_run_long_until_success(name, cmd):
        attempt = 1
        while attempt < 101:
            try:
                if attempt > 1:
                    Static.msg("RETRYING", "VALIDATE in 15s")
                    time.sleep(15)

                Cmd.local_run_long(name, cmd)
                return
            except:
                attempt += 1
コード例 #18
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
    def registry_port_forward_disable(self):
        name = "Disable PortForward to Registy"

        cmd1 = "kill $(shell cat {0}/port-forward.pid) || true".format(
            self.settings.folder_user_populated)
        cmd1_out = Cmd.local_run_get_out(name, cmd1)
        cmd2 = "rm -f {0}/port-forward.pid".format(
            self.settings.folder_user_populated)
        cmd2_out = Cmd.local_run_get_out(name, cmd2)

        Static.msg(name, master_node)
        Static.msg(">", cmd)
        return master_node
コード例 #19
0
 def start(self):
     Static.figletcyber("PROVISIONING")
     if self.settings.provision.cloud == "aws":
         self.kops.create_cluster()
         self.kops.update_settings()
         self.kops.provision_cluster()
     elif self.settings.provision.cloud == "minikube":
         self.minikube.config_vm_virtualbox()
         self.minikube.start()
         self.minikube.confirm_started()
     else:
         Static.msg_bold("No such provisioner specified in config", self.settings.provision.cloud)
         raise SystemExit(32)
コード例 #20
0
ファイル: cmd.py プロジェクト: christinataft/cli
    def local_run_get_out_raw(name, cmd):
        proc1 = subprocess.Popen(cmd,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 shell=True,
                                 preexec_fn=os.setsid)
        out = proc1.communicate()

        if proc1.returncode != 0:
            Static.msg_bold("FAIL", name.upper())
            sys.stdout.write(out[1])
            raise SystemExit(32)

        return out[0]
コード例 #21
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
    def create_cluster(self):
        name = "CREATE CLUSTER"
        Static.figletcyber(name)

        cmd = "kops create cluster --zones {0} --vpc {1} --dns-zone={2} --state={3} {4}".format(
            self.settings.aws_zone,
            self.settings.provision.vpc_id,
            self.settings.provision.dnszone_id,
            self.settings.provision.s3_store,
            self.settings.provision.domain
        )
        print cmd
        Static.msg(name, "KOPS: aws")
        Cmd.local_run_long(name, cmd)
コード例 #22
0
ファイル: cmdkubectl.py プロジェクト: christinataft/cli
 def use_context(self):
     name = "Kubectl Use Context"
     cmd = None
     context = None
     if self.settings.provision.cloud != "minikube":
         cmd = "kubectl config use-context {0}".format(
             self.settings.provision.domain)
         context = self.settings.provision.domain
     else:
         cmd = "kubectl config use-context minikube"
         context = "minikube"
     Static.msg(name, context)
     Cmd.local_run_long(name, cmd)
     print
コード例 #23
0
ファイル: main.py プロジェクト: Veseha/Money_manager_byVeseha
 def staticW(self):
     cur = self.base.cursor()
     a = cur.execute(
         'SELECT * FROM operation WHERE scorename == "{}"'.format(
             self.comboBox.currentText())).fetchall()
     if a:
         self.staticWW = Static(self.comboBox.currentText())
         self.staticWW.show()
     else:
         message = QMessageBox()
         message.setIcon(QMessageBox.Information)
         message.setText('Отсуствуют операции!')
         message.setWindowTitle('Информация')
         message.setStandardButtons(QMessageBox.Ok)
         message.exec()
コード例 #24
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
    def update_cluster(self):
        name = "UPDATE CLUSTER"
        Static.figletcyber(name)

        task = "Rolling Update CLuster"
        cmd = "kops rolling-update cluster {0} --state={1} --yes -v={2} 2>&1".format(
            self.settings.provision.domain,
            self.settings.provision.s3_store,
            self.settings.provision.kops_verbosity
        )
        Static.msg(name, task)
        print cmd
        Cmd.local_run_long(name, cmd)

        self.validate_cluster()
コード例 #25
0
ファイル: cmdkops.py プロジェクト: christinataft/cli
    def provision_cluster(self):
        name = "PROVISION CLUSTER"
        Static.figletcyber(name)

        task = "Provision in Cloud"
        cmd = "kops update cluster {0} --state={1} --yes -v={2} 2>&1".format(
            self.settings.provision.domain,
            self.settings.provision.s3_store,
            self.settings.provision.kops_verbosity
        )
        Static.msg(name, task)
        print cmd
        Cmd.local_run_long(name, cmd)

        self.validate_cluster()
コード例 #26
0
def update_not_deal_method(domain, exist):
    if exist:
        Static.whois_db.set_whois_flag(domain, -98)
    else:
        domain_whois = {
            'domain_hash': hash(domain),  # 域名哈希值
            "domain": domain,  # 域名
            "flag": -98,  # 状态标记
            "domain_status": "",  # 域名状态
            "sponsoring_registrar": "",  # 注册商
            "top_whois_server": "",  # 顶级域名服务器
            "sec_whois_server": "",  # 二级域名服务器
            "reg_name": "",  # 注册姓名
            "reg_phone": "",  # 注册电话
            "reg_email": "",  # 注册email
            "org_name": "",  # 注册公司名称
            "creation_date": "",  # 创建时间
            "expiration_date": "",  # 到期时间
            "updated_date": "",  # 更新时间
            "insert_time": Static.get_now_time(),  # 信息插入时间
            "details": "",  # 细节
            "name_server": "",  # 域名服务器
            "whois_hash": 0,  # whois信息哈希值
        }
        Static.whois_db.db_whois_insert(**domain_whois)
コード例 #27
0
ファイル: cmd.py プロジェクト: christinataft/cli
    def local_run_realtime_continue_on_fail(name, cmd):
        proc1 = subprocess.Popen(cmd,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 shell=True)

        # Poll process for new output until finished
        while True:
            nextline = proc1.stdout.readline()
            if nextline == '' and proc1.poll() is not None:
                break
            sys.stdout.write(nextline)
            sys.stdout.flush()

        output = proc1.communicate()
        if proc1.returncode != 0:
            Static.msg_bold("FAIL {0}".format(name.upper()), output[1])
コード例 #28
0
ファイル: cmd.py プロジェクト: christinataft/cli
    def local_run_long(name, cmd):
        proc1 = subprocess.Popen(cmd,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 shell=True,
                                 preexec_fn=os.setsid)

        while proc1.returncode is None:
            for line in proc1.stdout:
                sys.stdout.write(line)
            proc1.poll()

        if proc1.returncode != 0:
            Static.msg_bold("FAIL", name.upper())
            for line in iter(proc1.stderr.readline, ''):
                sys.stdout.write(line)
            raise SystemExit(32)
コード例 #29
0
ファイル: cmd.py プロジェクト: christinataft/cli
    def local_run_long_until_ready(name, cmd):
        result = False
        while not result:
            proc1 = subprocess.Popen(cmd,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE,
                                     shell=True,
                                     preexec_fn=os.setsid)
            proc1.wait()

            for line in iter(proc1.stdout.readline, ''):
                if not "ready: true" in line:
                    Static.msg("Waiting for", name.upper())
                    time.sleep(10)
                    continue

            Static.msg("Success for", name.upper())
            return
コード例 #30
0
ファイル: match.py プロジェクト: TheodorStraube/spectator
    def __init__(self,
                 platformId='',
                 gameId=-1,
                 champion=-1,
                 queue=-1,
                 season=-1,
                 timestamp=-1,
                 role='',
                 lane=''):
        self.region = platformId
        self.id = gameId
        self.champion = champion
        self.queue = queue
        self.season = season
        self.timestamp = timestamp
        self.role = role
        self.lane = lane

        self.static = Static(self.region)