Skip to main content

Sunbasket is an embedded algorithmic auxiliary management tool that mainly provides five categories of information management, including algorithm, model, parameter, application, and data, model storage management, and algorithm logging. The main technologies use SQLite, ORM, and logging, and the design mode is factory mode.

Project description

SunBasket-算法信息存储管理工具

shields_version shields_license shields_author shiedls_python

sunbasketsymbol

介绍

  • SunBasket是一款嵌入式算法辅助管理工具,主要提供五类信息管理,包括算法、模型、参数、应用程序和数据、模型存储管理和算法日志。主要技术使用SQLite、ORM和logging,设计模式为工厂模式。

安装

SunBasket采用Python开发,得益于Python良好的社区环境,安装支持Pythonic风格的各种管理器。

	$ pip install sunbasket-0.1-xxxxxxxxxxxx.whl

快速指南

  • SunBasket提供python-sdk的日志转发至SQLite的日志记录功能,算法、模型、参数、应用、数据的信息管理功能以及模型的存储功能,以下是SunBasket主程脚本示例:
import logging
from sunbasket.handler import SQLiteHandler
from sunbasket.data import AlgorithmInfoManager,ModelInfoManager,ParameterInfoManager,ApplicationInfoManager,DataInfoManager,ModelStoreManager,serialize_data,deserialize_data



####### 手动日志测试
### 创建日志操作对象
logger = logging.getLogger()
### 设置日志操作对象的日志等级
logger.setLevel(logging.INFO)
### 创建一个SQLite处理器
# SQLiteHandler = SQLiteHandler(log_database='sqlite:///E:\\workspace\\SunBasket\\Demo\\test.db')
SQLiteHandler = SQLiteHandler()
### 设置SQLite处理器的日志等级
SQLiteHandler.setLevel(logging.INFO)
### 向日志操作对象添加SQLite处理器
logger.addHandler(SQLiteHandler)
logger.info('start test log handler')
logger.warning('this is a warning log')



####### 信息管理测试
### 连接数据库 
connect_info = 'sqlite:///E:\\workspace\\SunBasket\\Demo\\test.db'
### 算法信息管理
algorithm_info_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'homepage': 'test homepage',
	'author': 'shihua',
	'authoremail': 'xxxxx@xxx.com',
	'license': 'MIT',
	'requires': 'numpy,pandas',
	'requiredby': 'xxxx'
}
algorithm_info = AlgorithmInfoManager(connect_info=connect_info,data_dict=algorithm_info_data_dict)
algorithm_info.add_data()


### 模型信息管理
model_info_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'requires': 'numpy,pandas',
	'data': 'test data',
	'algorithm': 'test algorithm'
}
model_info = ModelInfoManager(connect_info=connect_info,data_dict=model_info_data_dict)
model_info.add_data()


### 参数信息管理
parameter_info_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'datatype': 'test datatype',
	'requiredby': 'xxxx'
}
parameter_info = ParameterInfoManager(connect_info=connect_info,data_dict=parameter_info_data_dict)
parameter_info.add_data()


### 应用信息管理
application_info_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'requires': 'test requires',
	'project': 'xxxx'
}
application_info = ApplicationInfoManager(connect_info=connect_info,data_dict=application_info_data_dict)
application_info.add_data()


### 数据信息管理
data_info_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'requireby': 'test requiredby',
	'datatype': 'test datatype',
	'project': 'xxxx'
}
data_info = DataInfoManager(connect_info=connect_info,data_dict=data_info_data_dict)
data_info.add_data()



####### 存储管理测试
### 模型存储管理
class TestModel(object):

	def __init__(self,name):
		self.name = name
		self.arg = 150

	def add(self,a,b):
		return a+b
test_model = TestModel(name='testmodel')
### 序列化数据对象
serialized_data = serialize_data(data=test_model) 
model_store_data_dict = {
	'name': 'test',
	'version': 'v001',
	'summary': 'test summary',
	'config': 'test config',
	'remark': 'test remark',
	'data': serialized_data
}
model_store = ModelStoreManager(connect_info=connect_info,data_dict=model_store_data_dict)
model_store.add_data()


### 读取目标模型
tmp_model = model_store.get_model_data(connect_info=connect_info,name='test',version='v001')
### 反序列化数据对象
tmp_model_data = deserialize_data(serialized_data=tmp_model.data)
print(tmp_model_data.name,tmp_model_data.arg,tmp_model_data.add(1,2))

设计

  • 基于python基础包logging开发日志转发处理器
  • 使用SQLite作为日志存储后端
  • 支持日志过滤和日志信息选择
  • 管理算法、模型、参数、应用和数据五大类信息
  • 模型的存储管理

技术列表

  • 数据库-SQLite
  • ORM
  • logging
  • 配置文件-yaml
  • 继承重写
  • 静态方法
  • 对象化

设计UML图

以下是设计的UML图: sunbasketuml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shihua-sunbasket-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shihua_sunbasket-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file shihua-sunbasket-0.1.1.tar.gz.

File metadata

  • Download URL: shihua-sunbasket-0.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for shihua-sunbasket-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9ac026332344d50d007deaffc2c735bf061b353902ad650ef3397d861f350a2
MD5 a7d8d12e21f5418ef1c0744f6c38c1b8
BLAKE2b-256 e94b81aea59518aaf548c4c59d0cd24a50f9587457f443a6131338b65f18daba

See more details on using hashes here.

File details

Details for the file shihua_sunbasket-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for shihua_sunbasket-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 734de43884c2d9931c54b113d957af4631d03134a5675b4b9ac401b55caef14f
MD5 6b249c8315ccfb2e621769ac8272c49c
BLAKE2b-256 9cb0ce003d28c91b33eb6f0cc8dd7b9dbb735dae577134aed5ef4e9ca5d86833

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page