0
# Service Tasks
1
2
Service-level tasks that operate independently of specific projects, including driver management and service-wide operations. These tasks perform maintenance and configuration operations at the Data Migration Service level.
3
4
## Capabilities
5
6
### Create or Update Service Task
7
8
Creates a new service task or updates an existing one.
9
10
```python { .api }
11
def create_or_update(
12
group_name: str,
13
service_name: str,
14
task_name: str,
15
parameters: ProjectTask,
16
**kwargs
17
) -> ProjectTask:
18
"""
19
Creates or updates a service-level task.
20
21
Parameters:
22
- group_name: Name of the resource group
23
- service_name: Name of the Data Migration Service
24
- task_name: Name of the service task
25
- parameters: Task configuration and properties
26
27
Returns:
28
ProjectTask object with current state and results
29
"""
30
```
31
32
### Get Service Task
33
34
Retrieves details and status of a service task.
35
36
```python { .api }
37
def get(
38
group_name: str,
39
service_name: str,
40
task_name: str,
41
expand: str = None,
42
**kwargs
43
) -> ProjectTask:
44
"""
45
Gets a service task with current status and results.
46
47
Parameters:
48
- group_name: Name of the resource group
49
- service_name: Name of the Data Migration Service
50
- task_name: Name of the service task
51
- expand: Properties to expand (e.g., "output")
52
53
Returns:
54
ProjectTask with current state and results
55
"""
56
```
57
58
### Delete Service Task
59
60
Deletes a service task.
61
62
```python { .api }
63
def delete(
64
group_name: str,
65
service_name: str,
66
task_name: str,
67
delete_running_tasks: bool = None,
68
**kwargs
69
) -> None:
70
"""
71
Deletes a service task.
72
73
Parameters:
74
- group_name: Name of the resource group
75
- service_name: Name of the Data Migration Service
76
- task_name: Name of the service task
77
- delete_running_tasks: Whether to delete if running
78
79
Returns:
80
None
81
"""
82
```
83
84
### Update Service Task
85
86
Updates properties of an existing service task.
87
88
```python { .api }
89
def update(
90
group_name: str,
91
service_name: str,
92
task_name: str,
93
parameters: ProjectTask,
94
**kwargs
95
) -> ProjectTask:
96
"""
97
Updates a service task.
98
99
Parameters:
100
- group_name: Name of the resource group
101
- service_name: Name of the Data Migration Service
102
- task_name: Name of the service task
103
- parameters: Updated task properties
104
105
Returns:
106
Updated ProjectTask object
107
"""
108
```
109
110
### Cancel Service Task
111
112
Cancels a running service task.
113
114
```python { .api }
115
def cancel(
116
group_name: str,
117
service_name: str,
118
task_name: str,
119
**kwargs
120
) -> ProjectTask:
121
"""
122
Cancels a running service task.
123
124
Parameters:
125
- group_name: Name of the resource group
126
- service_name: Name of the Data Migration Service
127
- task_name: Name of the service task
128
129
Returns:
130
ProjectTask with updated state
131
"""
132
```
133
134
### List Service Tasks
135
136
Lists all service tasks within a Data Migration Service.
137
138
```python { .api }
139
def list(
140
group_name: str,
141
service_name: str,
142
task_type: str = None,
143
**kwargs
144
) -> ItemPaged[ProjectTask]:
145
"""
146
Lists service tasks in a Data Migration Service.
147
148
Parameters:
149
- group_name: Name of the resource group
150
- service_name: Name of the Data Migration Service
151
- task_type: Filter by task type (optional)
152
153
Returns:
154
Paged collection of ProjectTask objects
155
"""
156
```
157
158
## Oracle Driver Management Tasks
159
160
Service tasks for managing Oracle OCI drivers required for Oracle database migrations.
161
162
### Check OCI Driver Task
163
164
```python { .api }
165
class CheckOCIDriverTaskProperties(ProjectTaskProperties):
166
"""Check Oracle OCI driver installation status."""
167
168
def __init__(self, input: CheckOCIDriverTaskInput = None, **kwargs):
169
"""
170
Parameters:
171
- input: Driver check input (optional)
172
"""
173
174
# Properties
175
input: CheckOCIDriverTaskInput
176
output: List[CheckOCIDriverTaskOutput]
177
```
178
179
### Install OCI Driver Task
180
181
```python { .api }
182
class InstallOCIDriverTaskProperties(ProjectTaskProperties):
183
"""Install Oracle OCI driver on the service."""
184
185
def __init__(self, input: InstallOCIDriverTaskInput = None, **kwargs):
186
"""
187
Parameters:
188
- input: Driver installation input (optional)
189
"""
190
191
# Properties
192
input: InstallOCIDriverTaskInput
193
output: List[InstallOCIDriverTaskOutput]
194
```
195
196
### Upload OCI Driver Task
197
198
```python { .api }
199
class UploadOCIDriverTaskProperties(ProjectTaskProperties):
200
"""Upload Oracle OCI driver to the service."""
201
202
def __init__(self, input: UploadOCIDriverTaskInput, **kwargs):
203
"""
204
Parameters:
205
- input: Driver upload input with driver package details
206
"""
207
208
# Properties
209
input: UploadOCIDriverTaskInput
210
output: List[UploadOCIDriverTaskOutput]
211
```
212
213
## Oracle Driver Task Input/Output Types
214
215
### Driver Task Inputs
216
217
```python { .api }
218
class CheckOCIDriverTaskInput:
219
"""Input for checking OCI driver status."""
220
221
def __init__(self, **kwargs): ...
222
223
# No specific properties - uses service defaults
224
225
class InstallOCIDriverTaskInput:
226
"""Input for installing OCI driver."""
227
228
def __init__(self, driver_package_name: str = None, **kwargs):
229
"""
230
Parameters:
231
- driver_package_name: Name of driver package to install
232
"""
233
234
# Properties
235
driver_package_name: str # Optional: specific driver package
236
237
class UploadOCIDriverTaskInput:
238
"""Input for uploading OCI driver."""
239
240
def __init__(self, driver_share: BlobShare, **kwargs):
241
"""
242
Parameters:
243
- driver_share: Blob storage location containing driver package
244
"""
245
246
# Properties
247
driver_share: BlobShare # Required: storage location with driver
248
```
249
250
### Driver Task Outputs
251
252
```python { .api }
253
class CheckOCIDriverTaskOutput:
254
"""Output from OCI driver check."""
255
256
# Properties
257
version: str # Installed driver version
258
ooci_driver_info: List[OracleOCIDriverInfo] # Driver details
259
validation_errors: List[ReportableException] # Any issues found
260
261
class InstallOCIDriverTaskOutput:
262
"""Output from OCI driver installation."""
263
264
# Properties
265
validation_errors: List[ReportableException] # Installation errors
266
installation_logs: List[str] # Installation log messages
267
268
class UploadOCIDriverTaskOutput:
269
"""Output from OCI driver upload."""
270
271
# Properties
272
validation_errors: List[ReportableException] # Upload errors
273
uploaded_driver_info: OracleOCIDriverInfo # Uploaded driver details
274
```
275
276
### Oracle Driver Information
277
278
```python { .api }
279
class OracleOCIDriverInfo:
280
"""Oracle OCI driver information."""
281
282
# Properties
283
driver_name: str # Driver package name
284
driver_size: str # Driver package size
285
ooci_driver_path: str # Installation path
286
version: str # Driver version
287
archive_checksum: str # Package checksum for validation
288
```
289
290
## Usage Examples
291
292
### Oracle Driver Management Workflow
293
294
```python
295
from azure.mgmt.datamigration.models import (
296
ProjectTask,
297
CheckOCIDriverTaskProperties,
298
InstallOCIDriverTaskProperties,
299
UploadOCIDriverTaskProperties,
300
UploadOCIDriverTaskInput,
301
BlobShare
302
)
303
304
# 1. Check current driver status
305
check_driver_task = ProjectTask(
306
properties=CheckOCIDriverTaskProperties()
307
)
308
309
task = client.service_tasks.create_or_update(
310
group_name="myResourceGroup",
311
service_name="myMigrationService",
312
task_name="checkOCIDriver",
313
parameters=check_driver_task
314
)
315
316
# Wait for completion and check results
317
check_result = client.service_tasks.get(
318
group_name="myResourceGroup",
319
service_name="myMigrationService",
320
task_name="checkOCIDriver",
321
expand="output"
322
)
323
324
if check_result.properties.output:
325
driver_info = check_result.properties.output[0]
326
print(f"Current driver version: {driver_info.version}")
327
328
# 2. Upload new driver if needed
329
driver_share = BlobShare(
330
sas_uri="https://mystorageaccount.blob.core.windows.net/drivers?sv=..."
331
)
332
333
upload_driver_task = ProjectTask(
334
properties=UploadOCIDriverTaskProperties(
335
input=UploadOCIDriverTaskInput(
336
driver_share=driver_share
337
)
338
)
339
)
340
341
upload_task = client.service_tasks.create_or_update(
342
group_name="myResourceGroup",
343
service_name="myMigrationService",
344
task_name="uploadOCIDriver",
345
parameters=upload_driver_task
346
)
347
348
# 3. Install the uploaded driver
349
install_driver_task = ProjectTask(
350
properties=InstallOCIDriverTaskProperties()
351
)
352
353
install_task = client.service_tasks.create_or_update(
354
group_name="myResourceGroup",
355
service_name="myMigrationService",
356
task_name="installOCIDriver",
357
parameters=install_driver_task
358
)
359
360
print("Oracle OCI driver management tasks initiated")
361
```
362
363
### Monitor Service Task Progress
364
365
```python
366
import time
367
368
def monitor_service_task(client, group_name, service_name, task_name):
369
"""Monitor service task execution until completion."""
370
371
while True:
372
task = client.service_tasks.get(
373
group_name=group_name,
374
service_name=service_name,
375
task_name=task_name,
376
expand="output"
377
)
378
379
state = task.properties.state
380
print(f"Service task {task_name} state: {state}")
381
382
if state in ["Succeeded", "Failed", "Canceled"]:
383
if task.properties.errors:
384
print("Task errors:")
385
for error in task.properties.errors:
386
print(f" - {error.message}")
387
break
388
389
time.sleep(30)
390
391
return task
392
393
# Example usage
394
completed_task = monitor_service_task(
395
client,
396
"myResourceGroup",
397
"myMigrationService",
398
"installOCIDriver"
399
)
400
```
401
402
## Error Handling
403
404
Common service task errors:
405
406
- **Driver conflicts**: Existing driver installation conflicts with new version
407
- **Storage access**: Unable to access driver packages in blob storage
408
- **Installation failures**: Driver installation encounters system errors
409
- **Permission issues**: Insufficient permissions for driver management
410
- **Resource constraints**: Service lacks resources for driver operations
411
412
Service tasks typically require elevated permissions and may take significant time to complete, especially driver installation operations. Monitor task progress and handle errors appropriately based on the specific operation being performed.