ep-sdk-4pd 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ep_sdk_4pd
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: 4paradigm Electricity Platform Service SDK Library for Python
5
5
  Home-page: https://gitlab.4pd.io/electricityproject/electricity-platform-sdk
6
6
  Author: 4paradigm Electricity Platform SDK
@@ -0,0 +1 @@
1
+ __version__ = '0.1.9'
@@ -70,12 +70,18 @@ class EpData:
70
70
 
71
71
  @staticmethod
72
72
  def get_predict_data(
73
- scope
73
+ scope,
74
+ is_test=False,
75
+ test_time=None,
74
76
  ):
75
77
  date_str = EpSystem.get_system_date(is_online=True)
76
78
  calculated_date = datetime.strptime(date_str, "%Y-%m-%d")
77
79
  system_date = calculated_date.strftime("%Y-%m-%d") # 转换回字符串
78
80
 
81
+ # 测试
82
+ if is_test:
83
+ system_date=test_time
84
+
79
85
  request = PredictDataRequest(
80
86
  scope=scope,
81
87
  system_date=system_date,
@@ -121,18 +121,24 @@ class EpSystem:
121
121
  return None
122
122
 
123
123
  @staticmethod
124
- def call_train_done(strategy_id: int = None):
125
- if strategy_id is None:
124
+ def call_train_done(
125
+ strategy_id: int = None,
126
+ script_strategy_id: int = None
127
+ ):
128
+ if (strategy_id is None
129
+ or script_strategy_id is None):
126
130
  return False
127
131
 
128
- request = CallTrainDoneRequest(strategy_id=strategy_id)
132
+ request = CallTrainDoneRequest(strategy_id=strategy_id,
133
+ script_strategy_id=script_strategy_id)
129
134
  full_url = f'{endpoint}{request.api}'
130
135
  headers = {
131
136
  'content-type': request.content_type,
132
137
  }
133
138
 
134
139
  payload = {
135
- 'strategy_id': request.strategy_id
140
+ 'strategy_id': request.strategy_id,
141
+ 'script_strategy_id': request.script_strategy_id
136
142
  }
137
143
 
138
144
  response = requests.request(
@@ -152,4 +158,4 @@ class EpSystem:
152
158
  if response.code == 200:
153
159
  return True
154
160
  else:
155
- return False
161
+ return False
@@ -178,12 +178,18 @@ class CallTrainDoneRequest(BaseRequest):
178
178
  输入:无,默认为EpSystem.get_run_strategy()["id"]
179
179
  """
180
180
 
181
- def __init__(self, strategy_id: int = None):
181
+ def __init__(
182
+ self,
183
+ strategy_id: int = None,
184
+ script_strategy_id: int = None
185
+ ):
182
186
  """
183
187
  Args:
184
- strategy_id: 是否线上环境
188
+ strategy_id
189
+ script_strategy_id
185
190
  """
186
191
  self.strategy_id = strategy_id
192
+ self.script_strategy_id = script_strategy_id
187
193
 
188
194
  super().__init__()
189
195
  self.api = f'/ep/api/sdk/call_train_done'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ep_sdk_4pd
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: 4paradigm Electricity Platform Service SDK Library for Python
5
5
  Home-page: https://gitlab.4pd.io/electricityproject/electricity-platform-sdk
6
6
  Author: 4paradigm Electricity Platform SDK
@@ -8,7 +8,7 @@ DESCRIPTION = '4paradigm Electricity Platform Service SDK Library for Python'
8
8
  AUTHOR = '4paradigm Electricity Platform SDK'
9
9
  AUTHOR_EMAIL = ''
10
10
  URL = 'https://gitlab.4pd.io/electricityproject/electricity-platform-sdk'
11
- VERSION = '0.1.7'
11
+ VERSION = '0.1.9'
12
12
  REQUIRES = ['requests']
13
13
 
14
14
  LONG_DESCRIPTION = ''
@@ -4,7 +4,7 @@ from ep_sdk_4pd.ep_system import EpSystem
4
4
  def test_call_train_done():
5
5
  print('-------------test_call_train_done-------------')
6
6
 
7
- data = EpSystem.call_train_done(strategy_id=None)
7
+ data = EpSystem.call_train_done(strategy_id=None,script_strategy_id=None)
8
8
  print(data)
9
9
  print('-------------------------------------')
10
10
 
@@ -4,7 +4,7 @@ from ep_sdk_4pd.ep_data import EpData
4
4
  def test_predict_data():
5
5
  print('-------------test_predict_data-------------')
6
6
 
7
- data = EpData.get_predict_data(scope="weather")
7
+ data = EpData.get_predict_data(scope="plant",is_test=True,test_time='2023-04-02')
8
8
  print(data)
9
9
  print('-------------------------------------')
10
10
 
@@ -1 +0,0 @@
1
- __version__ = '0.1.7'
File without changes
File without changes