========
快速指南
========
首先使用atomctl命令行工具进行工作空间设置和初始化操作。然后分别启动元数据服务和atom主服务(两个服务未支持后台开启)。

以下是atomctl命令行示例：

.. code-block:: bash

	$ atomctl set --workspace 'D:\Workspace\JiYuan\Atom\Demo\test'

	$ atomctl init

	$ atomctl metadata-service 

	$ atomctl start-service 

然后就是使用python脚本进行atom的数据和算子操作。主要包括数据和算子的注册、查询、删除三个基本操作以及算子的加载操作


以下是atom主程脚本代码示例：

.. code-block:: python

	from atom.scheduler import *

	### 加载Atom调度器
	atom = AtomScheduler(mode='delay')


	### register-data测试
	df = pd.read_csv(r"D:\Workspace\JiYuan\WindPowerForecast\LSTM\demo\merge_data_GDTYUAN_ec.csv")
	atom.data_register(tag='test',
	                   belong='first',
	                   object_name='merge_data_GDTYUAN_ec_1',
	                   data_object=df,
	                   remarks='this is a test data!')

	### register-operator测试
	### 即时模式----装饰器方式
	# @atom.operator_register(tag='test',
	#                         belong='first',
	#                         object_name='test_function_a',
	#                         remarks='this is a test operator!')
	def test_function(a,b):
	    c = a + b * 2 + 1
	    return c
	# tmp_a = test_function(1,2)
	### 及时模式----函数方式
	# tmp_func = atom.operator_register(tag='test',
	#                         belong='first',
	#                         object_name='test_function_b',
	#                         remarks='this is a test operator!')(test_function)
	# tmp_b = tmp_func(3,4) 
	### 延时模式
	atom.operator_register(tag='test',
	                       belong='first',
	                       object_name='test_function_a', ## cc
	                       operator_object=test_function,
	                       remarks='this is a test operator!')


	# ### data-remove测试
	# atom.data_remove(tag='test',object_name='merge_data_GDTYUAN_ec_00')


	### operator-remove测试
	# atom.operator_remove(tag='test',object_name='test_function_cc')
	 
	                       
	### data-query测试
	data_view_df = atom.data_query(tag='test')
	print(data_view_df)


	### operator-query测试
	operator_view_df = atom.operator_query(tag='test')
	print(operator_view_df)


	### data-modify测试
	atom.data_modify()


	### operator-modify测试
	atom.operator_modify()


	### data-load测试
	data_load_df = atom.data_load(tag='test',object_name='merge_data_GDTYUAN_ec_1')
	print(data_load_df)


	### operator-load测试
	operator_load_a = atom.operator_load(tag='test',object_name='test_function_a')
	print(operator_load_a(10,20))
	# print(test_function(**{'a':10,'b':20})) ### 字典参数传递

最后是算子在线计算服务的使用。当一个算子注册到atom后，他就自动获得了在线计算服务的功能。

表单数据格式如下：

.. code-block:: python

	### 该表单数据仅以python为例展示
	post_form = {
    "tag": "test",
    "object_name": "test_function_a",
	"data_json": {"a":78,"b":9}
	}




































