liuyuqi-dellpc 5 years ago
parent
commit
5de0dc0eb1
9 changed files with 143 additions and 0 deletions
  1. 13 0
      code/change_dir.py
  2. 14 0
      code/main.ipynb
  3. 10 0
      code/main.py
  4. 23 0
      code/read_file.py
  5. 23 0
      code/read_file2.py
  6. 31 0
      code/save_conf.py
  7. 10 0
      code/save_result.py
  8. 7 0
      conf/config.ini
  9. 12 0
      setup.py

+ 13 - 0
code/change_dir.py

@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+@Auther :liuyuqi.gov@msn.cn
+@Time :2018/7/4 16:55
+@File :change_dir.py
+'''
+
+import os
+
+print(os.getcwd())
+
+os.chdir(os.getcwd())

+ 14 - 0
code/main.ipynb

@@ -0,0 +1,14 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 0
+}

+ 10 - 0
code/main.py

@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+@Auther :liuyuqi.gov@msn.cn
+@Time :2018/7/4 15:55
+@File :main.py
+'''
+
+if __name__ == '__main__':
+    pass

+ 23 - 0
code/read_file.py

@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+@Auther :liuyuqi.gov@msn.cn
+@Time :2018/7/4 16:46
+@File :read_file.py
+'''
+
+import csv
+from configparser import ConfigParser
+
+config_path = "../conf/config.ini"
+section_name = "data_file_name"
+cf = ConfigParser()
+cf.read(config_path)
+# app_interference
+# app_resources
+# instance_deploy
+# machine_resources
+
+with csv.reader(cf.get(section_name, "app_interference"), "r") as f:
+    for line in f:
+        print(line)

+ 23 - 0
code/read_file2.py

@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+@Auther :liuyuqi.gov@msn.cn
+@Time :2018/7/4 17:15
+@File :read_file2.py
+'''
+
+import pandas as pd,numpy as np
+import os,sys
+from  configparser import ConfigParser
+
+config_path = "../conf/config.ini"
+section_name = "data_file_name"
+cf = ConfigParser()
+cf.read(config_path)
+# app_interference
+# app_resources
+# instance_deploy
+# machine_resources
+
+df=pd.read_csv(cf.get(section_name, "app_interference"),encoding="utf-8")
+print(df)

+ 31 - 0
code/save_conf.py

@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+@Auther :liuyuqi.gov@msn.cn
+@Time :2018/7/4 15:55
+@File :main.py
+'''
+from configparser import ConfigParser
+
+config_file = "../conf/config.ini"
+data_path = "../data/"
+section_name = "data_file_name"
+cf = ConfigParser()
+
+
+def write():
+    if not cf.has_section(section_name):
+        cf.add_section(section_name)
+    cf.set(section_name, "app_interference", data_path+"scheduling_preliminary_app_interference_20180606.csv")
+    cf.set(section_name, "app_resources", data_path+"scheduling_preliminary_app_resources_20180606.csv")
+    cf.set(section_name, "instance_deploy", data_path+"duling_preliminary_instance_deploy_20180606.csv")
+    cf.set(section_name, "machine_resources", data_path+"scheduling_preliminary_machine_resources_20180606.csv")
+    with open(config_file, "w") as f:
+        cf.write(f)
+
+
+def read():
+    cf.read(config_file)
+    print(cf.get(section_name, "app_interference"))
+
+write()

+ 10 - 0
code/save_result.py

@@ -0,0 +1,10 @@
+# 导出数据结果
+import datetime
+
+import pandas as pd
+
+head = ["instance", "machine"]
+data = [["ss","aa" ],["ss","aa" ],["ss","aa" ],["ss","aa" ]]
+
+df = pd.DataFrame(data, columns=head)
+df.to_csv(("../submit/submit_" + datetime.datetime.now().strftime('%Y%m%d_%H%M%S') + ".csv"), header=None, index=False)

+ 7 - 0
conf/config.ini

@@ -0,0 +1,7 @@
+data_file_name :
+
+scheduling_preliminary_submit_sample_20180606.csv
+scheduling_preliminary_app_interference_20180606.csv
+scheduling_preliminary_app_resources_20180606.csv
+scheduling_preliminary_instance_deploy_20180606.csv
+scheduling_preliminary_machine_resources_20180606.csv

+ 12 - 0
setup.py

@@ -0,0 +1,12 @@
+from distutils.core import setup
+
+setup(
+    name='ServerManager',
+    version='1.0.0.1',
+    packages=[''],
+    url='http://blog.yoqi.me',
+    license='Apache2.0',
+    author='liuyuqi',
+    author_email='liuyuqi.gov@msn.cn',
+    description='阿里云服务器调度项目'
+)