SilverStreamingApplication 1.9__tar.gz → 1.10__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.
Files changed (22) hide show
  1. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/PKG-INFO +3 -2
  2. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/WorkflowBuilder.py +42 -20
  3. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/setup.py +1 -1
  4. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/silverstreamingapplication.egg-info/PKG-INFO +3 -2
  5. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/Maintenance.py +0 -0
  6. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/Operations.py +0 -0
  7. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/PartitionAnalyzer.py +0 -0
  8. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/PerfAnalyzer.py +0 -0
  9. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/SilverMerge.py +0 -0
  10. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/__init__.py +0 -0
  11. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/logging.py +0 -0
  12. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/sparksession.py +0 -0
  13. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/utils.py +0 -0
  14. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/main/utilsDatabricksAPI.py +0 -0
  15. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/tests/OperationsTest.py +0 -0
  16. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/tests/__init__.py +0 -0
  17. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/tests/main_test.py +0 -0
  18. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/com/phida/tests/utils_test.py +0 -0
  19. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/setup.cfg +0 -0
  20. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/silverstreamingapplication.egg-info/SOURCES.txt +0 -0
  21. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/silverstreamingapplication.egg-info/dependency_links.txt +0 -0
  22. {silverstreamingapplication-1.9 → silverstreamingapplication-1.10}/silverstreamingapplication.egg-info/top_level.txt +0 -0
@@ -1,7 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: silverstreamingapplication
3
- Version: 1.9
3
+ Version: 1.10
4
4
  Summary: initial version
5
5
  Home-page:
6
6
  Author:
7
7
  Author-email:
8
+ Dynamic: summary
@@ -60,7 +60,9 @@ class WorkflowBuilder:
60
60
  ('dbr_version', ['10.4.x-scala2.12', '10.4.x-scala2.12']),
61
61
  ('driver_type', ['Standard_E8ds_v4', 'Standard_E8ds_v4']),
62
62
  ('worker_type', ['Standard_E8ds_v4', 'Standard_E8ds_v4']),
63
- ('num_workers', ['4', '4'])])
63
+ # ('num_workers', ['4', '4'])])
64
+ ('min_workers', ['1', '1']),
65
+ ('max_workers', ['4', '4'])])
64
66
  # example of library argument: "SilverStreamingApplication==1.0"
65
67
 
66
68
 
@@ -160,7 +162,7 @@ class WorkflowBuilder:
160
162
  return taskDict
161
163
 
162
164
  @staticmethod
163
- def createJobCluster(jobClusterKey, DBRVersion, clusterPolicyId, numWorkers):
165
+ def createJobCluster(jobClusterKey, DBRVersion, clusterPolicyId, autoscaleFlag, minWorkers, maxWorkers):
164
166
  """
165
167
  desc:
166
168
  A method for creating the reusable job cluster
@@ -169,7 +171,9 @@ class WorkflowBuilder:
169
171
  jobClusterKey - a key for uniquely identifying a job cluster
170
172
  DBRVersion - the version of the databricks release to be used
171
173
  clusterPolicyId - Define the Id for the cluster policy for which table will be created in JSON
172
- numWorkers - The target database for writing the table or creating the metadata
174
+ autoscaleFlag - 'Y' for an autoscaling cluster, 'N' for a fixed size cluster
175
+ minWorkers - Minimum workers when autoscaling (ignored when autoscaleFlag is N)
176
+ maxWorkers - Maximum workers when autoscaling, or the fixed worker count when autoscaleFlag is N
173
177
 
174
178
 
175
179
  return:
@@ -179,20 +183,34 @@ class WorkflowBuilder:
179
183
  createTask("task1", "job_cluster_1", "/users/usr/notebook", "/opt/db","<source database name>", "<target database name>", "vbuk")
180
184
 
181
185
  tip:
182
- There are many either or parameters in this
183
- Either, enter numWorkers or autoScale as Y. Do no enter both
184
- When autoScale is Y, make sure that minWorkers and maxWorkers are present too
186
+ Autoscaling requires both minWorkers and maxWorkers.
185
187
  Either enter workerType and driverType or driverInstancePoolId and instancePoolId.
186
188
  Do not enter values for all 4 parameters mentioned above.
187
189
  """
188
- jobClusterDict = {
189
- "job_cluster_key": jobClusterKey,
190
- "new_cluster": {
191
- "spark_version": DBRVersion,
192
- "policy_id": clusterPolicyId,
193
- "num_workers": numWorkers
190
+
191
+ if str(autoscaleFlag).strip().upper() == "N":
192
+ numWorkers = int(maxWorkers)
193
+ jobClusterDict = {
194
+ "job_cluster_key": jobClusterKey,
195
+ "new_cluster": {
196
+ "spark_version": DBRVersion,
197
+ "policy_id": clusterPolicyId,
198
+ "num_workers": numWorkers
199
+ }
200
+ }
201
+ else:
202
+ minWorkers = int(minWorkers or 1)
203
+ maxWorkers = int(maxWorkers)
204
+ if minWorkers > maxWorkers:
205
+ raise ValueError(f"{jobClusterKey}: min_workers cannot be greater than max_workers")
206
+ jobClusterDict = {
207
+ "job_cluster_key": jobClusterKey,
208
+ "new_cluster": {
209
+ "spark_version": DBRVersion,
210
+ "policy_id": clusterPolicyId,
211
+ "autoscale": {"min_workers": minWorkers, "max_workers": maxWorkers}
212
+ }
194
213
  }
195
- }
196
214
 
197
215
  return jobClusterDict
198
216
 
@@ -293,17 +311,21 @@ class WorkflowBuilder:
293
311
  for jobCluster in jobClusterList:
294
312
  jobClusterKey = jobCluster['job_cluster_key']
295
313
  DBRVersion = jobCluster['dbr_version']
296
- try:
297
- numWorkers = jobCluster['num_workers']
298
- except:
299
- numWorkers = None
300
-
301
314
  try:
302
315
  clusterPolicyId = jobCluster['policy_id']
303
316
  except:
304
317
  clusterPolicyId = None
305
-
306
- jobClusterTemp = self.createJobCluster(jobClusterKey, DBRVersion, clusterPolicyId, numWorkers)
318
+ autoscaleFlag = jobCluster.get('autoscaleFlag', jobCluster.get('autoscale_flag'))
319
+ minWorkers = jobCluster['min_workers']
320
+ maxWorkers = jobCluster['max_workers']
321
+ jobClusterTemp = self.createJobCluster(
322
+ jobClusterKey,
323
+ DBRVersion,
324
+ clusterPolicyId,
325
+ autoscaleFlag,
326
+ minWorkers,
327
+ maxWorkers
328
+ )
307
329
 
308
330
  jobClusters.append(jobClusterTemp)
309
331
 
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='silverstreamingapplication',
5
- version='1.9',
5
+ version='1.10',
6
6
  packages=['com.phida.main', 'com.phida.tests'],
7
7
  url='',
8
8
  license='',
@@ -1,7 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: silverstreamingapplication
3
- Version: 1.9
3
+ Version: 1.10
4
4
  Summary: initial version
5
5
  Home-page:
6
6
  Author:
7
7
  Author-email:
8
+ Dynamic: summary