Skip to content

Commit

Permalink
Added support for Data Integration Workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
AnykeyNL committed Sep 10, 2021
1 parent d04b173 commit c3807c3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
56 changes: 56 additions & 0 deletions AutoScaleALL.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ def autoscale_region(region):
if resource.resource_type == "GoldenGateDeployment":
resourceDetails = goldengate.get_deployment(deployment_id=resource.identifier, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY).data
resourceOk = True
if resource.resource_type == "DISWorkspace":
resourceDetails = dataintegration.get_workspace(workspace_id=resource.identifier, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY).data
resourceOk = True

if not isDeleted(resource.lifecycle_state) and resourceOk:
schedule = resourceDetails.defined_tags[PredefinedTag]
Expand Down Expand Up @@ -1442,6 +1445,58 @@ def autoscale_region(region):
errors.append(" - Error ({}) GoldenGate startup for {} - {}".format(response.status, resource.display_name, response.message))
Retry = False

###################################################################################
# Data Integration Workshop
###################################################################################
if resource.resource_type == "DISWorkspace":
if int(schedulehours[CurrentHour]) == 0 or int(schedulehours[CurrentHour]) == 1:
if resourceDetails.lifecycle_state == "ACTIVE" and int(
schedulehours[CurrentHour]) == 0:
if Action == "All" or Action == "Down":
MakeLog(" - Initiate Data Integration Workspace shutdown for {}".format(resource.display_name))
Retry = True
while Retry:
try:
response = dataintegration.stop_workspace(workspace_id=resource.identifier)
Retry = False
success.append(" - Initiate Data Integration Workspace shutdown for {}".format(
resource.display_name))
except oci.exceptions.ServiceError as response:
if response.status == 429:
MakeLog("Rate limit kicking in.. waiting {} seconds...".format(
RateLimitDelay))
time.sleep(RateLimitDelay)
else:
ErrorsFound = True
errors.append(
" - Error ({}) Data Integration Workspace Shutdown for {} - {}".format(
response.status, resource.display_name, response.message))
MakeLog(" - Error ({}) Data Integration Shutdown for {} - {}".format(
response.status, resource.display_name, response.message))
Retry = False

if resourceDetails.lifecycle_state == "STOPPED" and int(
schedulehours[CurrentHour]) == 1:
if Action == "All" or Action == "Up":
MakeLog(" - Initiate Data Integration Workspace startup for {}".format(resource.display_name))
Retry = True
while Retry:
try:
response = dataintegration.start_workspace(workspace_id=resource.identifier)
Retry = False
success.append(" - Initiate Data Integration Workspace startup for {}".format(
resource.display_name))
except oci.exceptions.ServiceError as response:
if response.status == 429:
MakeLog("Rate limit kicking in.. waiting {} seconds...".format(
RateLimitDelay))
time.sleep(RateLimitDelay)
else:
ErrorsFound = True
errors.append(" - Error ({}) Data Integration Startup startup for {} - {}".format(
response.status, resource.display_name, response.message))
Retry = False

###################################################################################
# Wait for any AutonomousDB and Instance Pool Start and rescale tasks completed
###################################################################################
Expand Down Expand Up @@ -1562,6 +1617,7 @@ def autoscale_region(region):
loadbalancer = oci.load_balancer.LoadBalancerClient(config, signer=signer)
mysql = oci.mysql.DbSystemClient(config, signer=signer)
goldengate = oci.golden_gate.GoldenGateClient(config, signer=signer)
dataintegration = oci.data_integration.DataIntegrationClient(config, signer=signer)

###############################################
# Run Scale Region
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The **AutoScaleALL** script: A single Auto Scaling script for all OCI resources
- Load Balancer: Scaling (between 10, 100, 400, 8000 Mbps)**
- MySQL Service: On/Off***
- GoldenGate: On/Off
- Data Integration Workspaces: On/Off

*Supports the original DB System resource model and the newer Cloud VM Cluster resource model (introduced in Nov 2020)

Expand Down

0 comments on commit c3807c3

Please sign in to comment.