aepp 0.6.2__tar.gz → 0.6.3__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.
- {aepp-0.6.2/aepp.egg-info → aepp-0.6.3}/PKG-INFO +2 -1
- aepp-0.6.3/aepp/__version__.py +1 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/catalog.py +59 -16
- {aepp-0.6.2 → aepp-0.6.3}/aepp/cli/__main__.py +254 -3
- aepp-0.6.3/aepp/edge.py +1224 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/flowservice.py +147 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/knowledgegraph.py +31 -1
- {aepp-0.6.2 → aepp-0.6.3/aepp.egg-info}/PKG-INFO +2 -1
- {aepp-0.6.2 → aepp-0.6.3}/aepp.egg-info/SOURCES.txt +1 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp.egg-info/requires.txt +1 -0
- {aepp-0.6.2 → aepp-0.6.3}/pyproject.toml +2 -1
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_cli_commands.py +526 -4
- aepp-0.6.3/tests/test_edge.py +807 -0
- aepp-0.6.2/aepp/__version__.py +0 -1
- aepp-0.6.2/aepp/edge.py +0 -365
- {aepp-0.6.2 → aepp-0.6.3}/LICENSE +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/MANIFEST.in +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/README.md +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/__init__.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/accesscontrol.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/ajo.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/classmanager.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/cli/__init__.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/cli/upsfieldsanalyzer.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/config.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/configs.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/connector.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/customerprofile.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/dataaccess.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/dataprep.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/datasets.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/datatypemanager.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/deletion.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/destination.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/destinationinstanceservice.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/exportDatasetToDataLandingZone.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/fieldgroupmanager.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/hygiene.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/identity.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/ingestion.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/manager_utils.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/observability.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/policy.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/privacyservice.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/queryservice.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/sandboxes.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/schema.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/schemamanager.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/segmentation.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/sensei.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/som.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/synchronizer.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/tags.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp/utils.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp.egg-info/dependency_links.txt +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp.egg-info/entry_points.txt +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/aepp.egg-info/top_level.txt +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/setup.cfg +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_ajo.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_extraction.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_import_modules.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_queryservice.py +0 -0
- {aepp-0.6.2 → aepp-0.6.3}/tests/test_synchronizer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aepp
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: Package to manage AEP API endpoint and some helper functions
|
|
5
5
|
Author-email: Julien Piccini <piccini.julien@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -30,6 +30,7 @@ Requires-Dist: psycopg2-binary; sys_platform == "linux"
|
|
|
30
30
|
Requires-Dist: rdflib
|
|
31
31
|
Requires-Dist: networkx
|
|
32
32
|
Requires-Dist: pygraphviz
|
|
33
|
+
Requires-Dist: azure-storage-blob
|
|
33
34
|
Dynamic: license-file
|
|
34
35
|
|
|
35
36
|
# Adobe Experience Platform API made for humans
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.3"
|
|
@@ -227,13 +227,16 @@ class Catalog:
|
|
|
227
227
|
return res
|
|
228
228
|
|
|
229
229
|
|
|
230
|
-
def getBatches(self,limit:int=10, n_results:int=None,output:str='raw',**kwargs)->Union[pd.DataFrame,dict]:
|
|
230
|
+
def getBatches(self,limit:int=10, n_results:int|str|None=None,output:str='raw',**kwargs)->Union[pd.DataFrame,dict,list[dict]]:
|
|
231
231
|
"""
|
|
232
|
-
Retrieve
|
|
232
|
+
Retrieve batches, optionally paging and converting the response.
|
|
233
233
|
Arguments:
|
|
234
|
-
limit :
|
|
235
|
-
n_results : OPTIONAL :
|
|
236
|
-
|
|
234
|
+
limit : OPTIONAL : Number of objects per request. Default 10, capped at 100.
|
|
235
|
+
n_results : OPTIONAL : Total result target; None requests one page.
|
|
236
|
+
Use "inf" to continue until an empty page. Complete pages can exceed the target.
|
|
237
|
+
output : OPTIONAL : "raw" returns a dictionary keyed by batch ID (default).
|
|
238
|
+
"df" or "dataframe" returns a DataFrame indexed by batch ID.
|
|
239
|
+
"list" returns batch dictionaries with an added id field.
|
|
237
240
|
Possible kwargs:
|
|
238
241
|
created : Filter by the Unix timestamp (in milliseconds) when this object was persisted.
|
|
239
242
|
createdAfter : Exclusively filter records created after this timestamp.
|
|
@@ -271,22 +274,24 @@ class Catalog:
|
|
|
271
274
|
res = self.connector.getData(self.endpoint+path,
|
|
272
275
|
headers=self.header, params=params)
|
|
273
276
|
list_return.update(**res)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if output=="dataframe":
|
|
277
|
+
res = list_return
|
|
278
|
+
else:
|
|
279
|
+
res = self.connector.getData(self.endpoint+path,
|
|
280
|
+
headers=self.header, params=params)
|
|
281
|
+
if output=="dataframe" or output=="df":
|
|
280
282
|
return pd.DataFrame(res).T
|
|
283
|
+
if output=="list":
|
|
284
|
+
return [{**item, "id": key} for key, item in res.items()]
|
|
281
285
|
return res
|
|
282
286
|
|
|
283
|
-
def getFailedBatchesDF(self,limit:int=10,n_results: str=None,orderBy:str="desc:created",**kwargs)->pd.DataFrame:
|
|
287
|
+
def getFailedBatchesDF(self,limit:int=10,n_results: int|str|None=None,orderBy:str="desc:created",**kwargs)->pd.DataFrame:
|
|
284
288
|
"""
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
Retrieve failed-batch summaries as a DataFrame indexed by batch ID.
|
|
290
|
+
Error codes and messages remain lists; ingestion metrics and metadata are included.
|
|
287
291
|
Arguments:
|
|
288
|
-
limit :
|
|
289
|
-
n_results : OPTIONAL :
|
|
292
|
+
limit : OPTIONAL : Number of objects per request. Default 10, capped at 100.
|
|
293
|
+
n_results : OPTIONAL : Total result target; None requests one page.
|
|
294
|
+
Use "inf" to continue until an empty page.
|
|
290
295
|
orderBy : OPTIONAL : The order of the batch. Default "desc:created"
|
|
291
296
|
Possible kwargs: Any additional parameter for filtering the requests
|
|
292
297
|
"""
|
|
@@ -315,6 +320,44 @@ class Catalog:
|
|
|
315
320
|
}
|
|
316
321
|
df = pd.DataFrame(dict_failed).T
|
|
317
322
|
return df
|
|
323
|
+
|
|
324
|
+
def getFailedBatches(self,limit:int=10,n_results: int|str|None=None,orderBy:str="desc:created",**kwargs)->list:
|
|
325
|
+
"""
|
|
326
|
+
Retrieve failed-batch summaries as a list containing batchId and error details.
|
|
327
|
+
Error codes and messages remain lists; ingestion metrics and metadata are included.
|
|
328
|
+
The summaries do not include status or id fields.
|
|
329
|
+
Arguments:
|
|
330
|
+
limit : OPTIONAL : Number of objects per request. Default 10, capped at 100.
|
|
331
|
+
n_results : OPTIONAL : Total result target; None requests one page.
|
|
332
|
+
Use "inf" to continue until an empty page.
|
|
333
|
+
orderBy : OPTIONAL : The order of the batch. Default "desc:created"
|
|
334
|
+
Possible kwargs: Any additional parameter for filtering the requests
|
|
335
|
+
"""
|
|
336
|
+
res = self.getBatches(status="failed",orderBy=orderBy,limit=limit,n_results=n_results,**kwargs)
|
|
337
|
+
if self.loggingEnabled:
|
|
338
|
+
self.logger.debug(f"Starting getFailedBatchesDF")
|
|
339
|
+
list_failed = []
|
|
340
|
+
for batch in res:
|
|
341
|
+
if type(batch) == str:
|
|
342
|
+
if res.get(batch,{}).get('relatedObjects',[{'type':'unknown'}])[0]['type'] == "dataSet":
|
|
343
|
+
datasetId = res[batch]['relatedObjects'][0]['id']
|
|
344
|
+
list_failed.append({
|
|
345
|
+
"batchId" : batch,
|
|
346
|
+
"timestamp" : res[batch]['created'],
|
|
347
|
+
"recordsSize" : res[batch].get('metrics',{}).get('recordsSize',0),
|
|
348
|
+
"invalidRecordsProfile" : res[batch].get('metrics',{}).get('invalidRecordsProfile',0),
|
|
349
|
+
"invalidRecordsIdentity" : res[batch].get('metrics',{}).get('invalidRecordsIdentity',0),
|
|
350
|
+
"invalidRecordCount" : res[batch].get('metrics',{}).get('invalidRecordCount',0),
|
|
351
|
+
"invalidRecordsStreamingValidation" : res[batch].get('metrics',{}).get('invalidRecordsStreamingValidation',0),
|
|
352
|
+
"invalidRecordsMapper" : res[batch].get('metrics',{}).get('invalidRecordsMapper',0),
|
|
353
|
+
"invalidRecordsUnknown" : res[batch].get('metrics',{}).get('invalidRecordsUnknown',0),
|
|
354
|
+
"errorCode" : [er['code'] for er in res[batch]['errors']],
|
|
355
|
+
"errorMessage" : [er['description'] for er in res[batch]['errors']],
|
|
356
|
+
"flowId" : res[batch].get('tags',{}).get('flowId',[None])[0],
|
|
357
|
+
"dataSetId" : datasetId,
|
|
358
|
+
"sandbox" : res[batch]['sandboxId'],
|
|
359
|
+
})
|
|
360
|
+
return list_failed
|
|
318
361
|
|
|
319
362
|
def getBatch(self, batch_id: str = None)->dict:
|
|
320
363
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import aepp
|
|
2
2
|
from aepp import synchronizer, schema, schemamanager, fieldgroupmanager, datatypemanager, identity, queryservice,catalog,flowservice,sandboxes, segmentation, customerprofile, knowledgegraph, deletion
|
|
3
|
-
from aepp import destinationinstanceservice
|
|
3
|
+
from aepp import destinationinstanceservice, edge
|
|
4
4
|
from aepp.cli.upsfieldsanalyzer import UpsFieldsAnalyzer
|
|
5
5
|
import argparse, cmd, shlex, json
|
|
6
6
|
from functools import wraps
|
|
@@ -1294,6 +1294,84 @@ class ServiceShell(cmd.Cmd):
|
|
|
1294
1294
|
except SystemExit:
|
|
1295
1295
|
return
|
|
1296
1296
|
|
|
1297
|
+
@login_required
|
|
1298
|
+
def do_get_datastreams(self, args: Any) -> None:
|
|
1299
|
+
"""
|
|
1300
|
+
List datastreams with ID, name and Platform/Analytics/Target/SSF/AAM/Adobe Advertising enabled flags.
|
|
1301
|
+
Usage: get_datastreams [-f FILTER]
|
|
1302
|
+
Export full matching records to <sandbox>_datastreams.json automatically.
|
|
1303
|
+
"""
|
|
1304
|
+
parser = argparse.ArgumentParser(prog="get_datastreams", add_help=True)
|
|
1305
|
+
parser.add_argument("-f", "--filter", default="", help="Case-insensitive partial match on datastream name")
|
|
1306
|
+
try:
|
|
1307
|
+
args = parser.parse_args(shlex.split(args))
|
|
1308
|
+
aepp_edge = edge.Edge(config=self.config)
|
|
1309
|
+
datastreams = aepp_edge.getDatastreams()
|
|
1310
|
+
if not isinstance(datastreams, list):
|
|
1311
|
+
raise ValueError(f"Datastream retrieval failed: {datastreams}")
|
|
1312
|
+
if datastreams:
|
|
1313
|
+
table = Table(title=f"Datastreams in Sandbox: {self.config.sandbox}")
|
|
1314
|
+
table.add_column("ID", style="cyan")
|
|
1315
|
+
table.add_column("Name", style="magenta")
|
|
1316
|
+
service_keys = (
|
|
1317
|
+
("Platform", "com_adobe_experience_platform"),
|
|
1318
|
+
("Analytics", "com_adobe_analytics"),
|
|
1319
|
+
("Target", "com_adobe_target"),
|
|
1320
|
+
("SSF", "com_adobe_launch_ssf"),
|
|
1321
|
+
("Audience Manager", "com_adobe_audiencemanager"),
|
|
1322
|
+
("Adobe Advertising", "com_adobe_advertising"),
|
|
1323
|
+
)
|
|
1324
|
+
for name, _ in service_keys:
|
|
1325
|
+
table.add_column(name, style="green")
|
|
1326
|
+
for definition in datastreams:
|
|
1327
|
+
settings = definition.get("settings", {})
|
|
1328
|
+
flags = [
|
|
1329
|
+
str(settings.get(key, {}).get("enabled", False) is True)
|
|
1330
|
+
for _, key in service_keys
|
|
1331
|
+
]
|
|
1332
|
+
flags = ["[green]True[/green]" if flag == "True" else "[red]False[/red]" for flag in flags]
|
|
1333
|
+
datastream_id = definition.get("id", "N/A")
|
|
1334
|
+
table.add_row(str(datastream_id), definition["title"], *flags)
|
|
1335
|
+
console.print(table)
|
|
1336
|
+
else:
|
|
1337
|
+
console.print("No datastreams found.", style="yellow")
|
|
1338
|
+
|
|
1339
|
+
filename = f"{self.config.sandbox}_datastreams.json"
|
|
1340
|
+
with open(filename, "w", encoding="utf-8") as file:
|
|
1341
|
+
json.dump(datastreams, file, indent=2)
|
|
1342
|
+
console.print(f"Datastreams exported to {filename}", style="green")
|
|
1343
|
+
except Exception as e:
|
|
1344
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
1345
|
+
except SystemExit:
|
|
1346
|
+
return
|
|
1347
|
+
|
|
1348
|
+
@login_required
|
|
1349
|
+
def do_get_datastream(self, args: Any) -> None:
|
|
1350
|
+
"""
|
|
1351
|
+
Display a datastream's full JSON definition by ID.
|
|
1352
|
+
Usage: get_datastream <datastream_id>
|
|
1353
|
+
Export the definition to datastream_<datastream_id>.json automatically.
|
|
1354
|
+
"""
|
|
1355
|
+
parser = argparse.ArgumentParser(prog="get_datastream", add_help=True)
|
|
1356
|
+
parser.add_argument("datastream_id", help="ID of the datastream to retrieve")
|
|
1357
|
+
try:
|
|
1358
|
+
args = parser.parse_args(shlex.split(args))
|
|
1359
|
+
if not args.datastream_id.strip():
|
|
1360
|
+
parser.error("Datastream ID must not be empty.")
|
|
1361
|
+
aepp_edge = edge.Edge(config=self.config)
|
|
1362
|
+
datastream = aepp_edge.getDatastream(datastreamId=args.datastream_id)
|
|
1363
|
+
if not isinstance(datastream, dict) or not isinstance(datastream.get("settings"), dict):
|
|
1364
|
+
raise ValueError(f"Datastream retrieval failed: {datastream}")
|
|
1365
|
+
console.print_json(data=datastream)
|
|
1366
|
+
filename = f"datastream_{args.datastream_id}.json"
|
|
1367
|
+
with open(filename, "w", encoding="utf-8") as file:
|
|
1368
|
+
json.dump(datastream, file, indent=2)
|
|
1369
|
+
console.print(f"Datastream definition exported to {filename}", style="green")
|
|
1370
|
+
except Exception as e:
|
|
1371
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
1372
|
+
except SystemExit:
|
|
1373
|
+
return
|
|
1374
|
+
|
|
1297
1375
|
@login_required
|
|
1298
1376
|
def do_get_datasets(self, args:Any) -> None:
|
|
1299
1377
|
"""List all datasets in the current sandbox"""
|
|
@@ -1328,6 +1406,90 @@ class ServiceShell(cmd.Cmd):
|
|
|
1328
1406
|
except SystemExit:
|
|
1329
1407
|
return
|
|
1330
1408
|
|
|
1409
|
+
@login_required
|
|
1410
|
+
def do_get_batches(self, args:Any) -> None:
|
|
1411
|
+
"""
|
|
1412
|
+
List newest batches in the current sandbox and display up to 10 rows.
|
|
1413
|
+
Usage: get_batches [-d DATASET_ID] [-l LIMIT]
|
|
1414
|
+
Request up to LIMIT batches (default 100, capped at 100).
|
|
1415
|
+
Export all retrieved records to <sandbox>_batches.json, or
|
|
1416
|
+
<sandbox>_<dataset_id>_batches.json when filtering by dataset ID.
|
|
1417
|
+
"""
|
|
1418
|
+
parser = argparse.ArgumentParser(prog='get_batches', add_help=True)
|
|
1419
|
+
parser.add_argument("-d","--dataSet",help="Filter the batches return by dataset ID",type=str,default="")
|
|
1420
|
+
parser.add_argument("-l","--limit",help="Number of batches to request (default 100, capped at 100)",type=int,default=100)
|
|
1421
|
+
try:
|
|
1422
|
+
args = parser.parse_args(shlex.split(args))
|
|
1423
|
+
aepp_cat = catalog.Catalog(config=self.config)
|
|
1424
|
+
if args.dataSet:
|
|
1425
|
+
batches = aepp_cat.getBatches(dataSet=args.dataSet,limit=args.limit,orderBy="desc:created",output="list")
|
|
1426
|
+
else:
|
|
1427
|
+
batches = aepp_cat.getBatches(limit=args.limit,orderBy="desc:created",output="list")
|
|
1428
|
+
table = Table(title=f"Last 10 batches in Sandbox: {self.config.sandbox} (Sample)")
|
|
1429
|
+
table.add_column("ID", style="white")
|
|
1430
|
+
table.add_column("Status", style="yellow")
|
|
1431
|
+
table.add_column("Created At", style="magenta")
|
|
1432
|
+
for batch in batches[:10]:
|
|
1433
|
+
table.add_row(
|
|
1434
|
+
batch.get("id","N/A"),
|
|
1435
|
+
batch.get("status","N/A"),
|
|
1436
|
+
datetime.fromtimestamp(batch.get("created",1000)/1000).isoformat().split('.')[0]
|
|
1437
|
+
)
|
|
1438
|
+
console.print(table)
|
|
1439
|
+
if args.dataSet:
|
|
1440
|
+
filename = f'{self.config.sandbox}_{args.dataSet}_batches.json'
|
|
1441
|
+
else:
|
|
1442
|
+
filename = f'{self.config.sandbox}_batches.json'
|
|
1443
|
+
with open(filename, 'w', newline='') as f:
|
|
1444
|
+
json.dump(batches, f, indent=2)
|
|
1445
|
+
console.print(f"Batches exported to {filename}", style="green")
|
|
1446
|
+
except Exception as e:
|
|
1447
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
1448
|
+
except SystemExit:
|
|
1449
|
+
return
|
|
1450
|
+
|
|
1451
|
+
@login_required
|
|
1452
|
+
def do_get_batches_errors(self,args:Any) -> None:
|
|
1453
|
+
"""
|
|
1454
|
+
List errors from failed batches in the current sandbox.
|
|
1455
|
+
Usage: get_batches_errors [-d DATASET_ID] [-l LIMIT]
|
|
1456
|
+
Request up to LIMIT failed batches (default 100, capped at 100).
|
|
1457
|
+
Display only the first 10 summaries and export all to <sandbox>_batches_errors.json,
|
|
1458
|
+
or <sandbox>_<dataset_id>_batches_errors.json when filtering by dataset ID.
|
|
1459
|
+
"""
|
|
1460
|
+
parser = argparse.ArgumentParser(prog='get_batches_errors', add_help=True)
|
|
1461
|
+
parser.add_argument("-d","--dataSet",help="filter by dataset ID",type=str,default=None)
|
|
1462
|
+
parser.add_argument("-l","--limit",help="Number of failed batches to request (default 100, capped at 100)",type=int,default=100)
|
|
1463
|
+
try:
|
|
1464
|
+
args = parser.parse_args(shlex.split(args))
|
|
1465
|
+
aepp_cat = catalog.Catalog(config=self.config)
|
|
1466
|
+
if args.dataSet:
|
|
1467
|
+
errors = aepp_cat.getFailedBatches(dataSet=args.dataSet,limit=args.limit)
|
|
1468
|
+
else:
|
|
1469
|
+
errors = aepp_cat.getFailedBatches(limit=args.limit)
|
|
1470
|
+
table = Table(title=f"Last 10 batches with errors in Sandbox: {self.config.sandbox} (Sample)")
|
|
1471
|
+
table.add_column("ID", style="white")
|
|
1472
|
+
table.add_column("Error Code", style="yellow")
|
|
1473
|
+
table.add_column("Error Message", style="magenta")
|
|
1474
|
+
for batch in errors[:10]:
|
|
1475
|
+
table.add_row(
|
|
1476
|
+
batch.get("batchId","N/A"),
|
|
1477
|
+
", ".join(batch.get("errorCode",[])),
|
|
1478
|
+
", ".join(batch.get("errorMessage",[]))
|
|
1479
|
+
)
|
|
1480
|
+
console.print(table)
|
|
1481
|
+
if args.dataSet:
|
|
1482
|
+
filename = f"{self.config.sandbox}_{args.dataSet}_batches_errors.json"
|
|
1483
|
+
else:
|
|
1484
|
+
filename = f"{self.config.sandbox}_batches_errors.json"
|
|
1485
|
+
with open(filename, 'w') as f:
|
|
1486
|
+
json.dump(errors, f, indent=2)
|
|
1487
|
+
console.print(f"Batches errors exported to {filename}", style="green")
|
|
1488
|
+
except Exception as e:
|
|
1489
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
1490
|
+
except SystemExit:
|
|
1491
|
+
return
|
|
1492
|
+
|
|
1331
1493
|
@login_required
|
|
1332
1494
|
def do_get_dataset(self,args:Any) -> None:
|
|
1333
1495
|
"""Get a dataset by exact name or ID and export dataset_<id>.json."""
|
|
@@ -2289,7 +2451,7 @@ class ServiceShell(cmd.Cmd):
|
|
|
2289
2451
|
activationInfo = {
|
|
2290
2452
|
args.flowId:args.audiences
|
|
2291
2453
|
}
|
|
2292
|
-
res = aepp_dest.createAdhocAudienceExport(
|
|
2454
|
+
res = aepp_dest.createAdhocAudienceExport(activationInfo=activationInfo, streaming=args.streaming)
|
|
2293
2455
|
if 'order' in res or 'jobs' in res:
|
|
2294
2456
|
console.print(f"Audience activation submitted for flow '{args.flowId}'", style="green")
|
|
2295
2457
|
console.print(f"Activation response: {res}", style="green")
|
|
@@ -2366,6 +2528,88 @@ class ServiceShell(cmd.Cmd):
|
|
|
2366
2528
|
except SystemExit:
|
|
2367
2529
|
return
|
|
2368
2530
|
|
|
2531
|
+
@login_required
|
|
2532
|
+
def do_get_landing_zone_tree(self,args:Any) -> None:
|
|
2533
|
+
"""Display an Azure Data Landing Zone folder tree as JSON.
|
|
2534
|
+
Usage: get_landing_zone_tree [-t TYPE]
|
|
2535
|
+
TYPE is user_drop_zone (default) or dlz_destination.
|
|
2536
|
+
"""
|
|
2537
|
+
parser = argparse.ArgumentParser(prog='get_landing_zone_tree', add_help=True)
|
|
2538
|
+
parser.add_argument("-t","--type", help="Data Landing Zone type (default: user_drop_zone)",
|
|
2539
|
+
default="user_drop_zone", choices=["user_drop_zone", "dlz_destination"])
|
|
2540
|
+
try:
|
|
2541
|
+
args = parser.parse_args(shlex.split(args))
|
|
2542
|
+
flw = flowservice.FlowService(config=self.config)
|
|
2543
|
+
tree = flw.getLandingZoneTree(dlz_type=args.type)
|
|
2544
|
+
console.print_json(data=tree)
|
|
2545
|
+
except Exception as e:
|
|
2546
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
2547
|
+
except SystemExit:
|
|
2548
|
+
return
|
|
2549
|
+
|
|
2550
|
+
@login_required
|
|
2551
|
+
def do_get_landing_zone_folder_infos(self,args:Any) -> None:
|
|
2552
|
+
"""Display file details for an Azure Data Landing Zone folder as JSON.
|
|
2553
|
+
Usage: get_landing_zone_folder_infos [folder_path] [-t TYPE]
|
|
2554
|
+
TYPE is "user_drop_zone" (default) or "dlz_destination".
|
|
2555
|
+
"""
|
|
2556
|
+
parser = argparse.ArgumentParser(prog='get_landing_zone_folder_infos', add_help=True)
|
|
2557
|
+
parser.add_argument("folder_path", nargs='?', help="Folder path; omit to list root files", default="")
|
|
2558
|
+
parser.add_argument("-t","--type", help="Data Landing Zone type (default: user_drop_zone)",
|
|
2559
|
+
default="user_drop_zone", choices=["user_drop_zone", "dlz_destination"])
|
|
2560
|
+
try:
|
|
2561
|
+
args = parser.parse_args(shlex.split(args))
|
|
2562
|
+
flw = flowservice.FlowService(config=self.config)
|
|
2563
|
+
files = flw.getLandingZoneFolderInfos(dlz_type=args.type, folder_path=args.folder_path)
|
|
2564
|
+
console.print_json(data=files)
|
|
2565
|
+
except Exception as e:
|
|
2566
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
2567
|
+
except SystemExit:
|
|
2568
|
+
return
|
|
2569
|
+
|
|
2570
|
+
@login_required
|
|
2571
|
+
def do_download_landing_zone_file(self,args:Any) -> None:
|
|
2572
|
+
"""
|
|
2573
|
+
Download an Azure Data Landing Zone file to disk.
|
|
2574
|
+
Usage: download_landing_zone_file file_path [-t TYPE] [-dp DESTINATION_PATH]
|
|
2575
|
+
TYPE is user_drop_zone (default) or dlz_destination. The destination
|
|
2576
|
+
"""
|
|
2577
|
+
parser = argparse.ArgumentParser(prog='download_landing_zone_file', add_help=True)
|
|
2578
|
+
parser.add_argument("file_path", help="Blob path of the file to download")
|
|
2579
|
+
parser.add_argument("-t","--type", help="Data Landing Zone type (default: user_drop_zone)",
|
|
2580
|
+
default="user_drop_zone", choices=["user_drop_zone", "dlz_destination"])
|
|
2581
|
+
parser.add_argument("-dp","--destination_path", help="Local path including filename; directory must exist", default=None)
|
|
2582
|
+
try:
|
|
2583
|
+
args = parser.parse_args(shlex.split(args))
|
|
2584
|
+
flw = flowservice.FlowService(config=self.config)
|
|
2585
|
+
flw.downloadLandingZoneFile(dlz_type=args.type, file_path=args.file_path, destination_path=args.destination_path)
|
|
2586
|
+
destination = args.destination_path if args.destination_path is not None else args.file_path.split("/")[-1]
|
|
2587
|
+
console.print(f"File downloaded to {destination}", style="green")
|
|
2588
|
+
except Exception as e:
|
|
2589
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
2590
|
+
except SystemExit:
|
|
2591
|
+
return
|
|
2592
|
+
|
|
2593
|
+
@login_required
|
|
2594
|
+
def do_upload_file_to_landing_zone(self,args:Any) -> None:
|
|
2595
|
+
"""Upload a local file to the user_drop_zone Azure Data Landing Zone.
|
|
2596
|
+
Usage: upload_file_to_landing_zone file_path blob_file_path
|
|
2597
|
+
Existing blobs at the destination are overwritten without confirmation.
|
|
2598
|
+
"""
|
|
2599
|
+
parser = argparse.ArgumentParser(prog='upload_file_to_landing_zone', add_help=True)
|
|
2600
|
+
parser.add_argument("file_path", help="Local path of the file to upload")
|
|
2601
|
+
parser.add_argument("blob_file_path", help="Destination blob path including filename; existing blobs are overwritten")
|
|
2602
|
+
try:
|
|
2603
|
+
args = parser.parse_args(shlex.split(args))
|
|
2604
|
+
flw = flowservice.FlowService(config=self.config)
|
|
2605
|
+
response = flw.uploadFileToLandingZone(file_path=args.file_path, blob_file_path=args.blob_file_path)
|
|
2606
|
+
console.print(f"File uploaded to {args.blob_file_path}", style="green")
|
|
2607
|
+
console.print(response)
|
|
2608
|
+
except Exception as e:
|
|
2609
|
+
console.print(f"(!) Error: {str(e)}", style="red")
|
|
2610
|
+
except SystemExit:
|
|
2611
|
+
return
|
|
2612
|
+
|
|
2369
2613
|
@login_required
|
|
2370
2614
|
def do_delete_dataset(self, args:Any) -> None:
|
|
2371
2615
|
"""Delete a dataset from the current sandbox. This is a destructive, irreversible operation - use with caution."""
|
|
@@ -3656,7 +3900,10 @@ class ServiceShell(cmd.Cmd):
|
|
|
3656
3900
|
"get_descriptors",
|
|
3657
3901
|
"get_descriptor"
|
|
3658
3902
|
],
|
|
3903
|
+
"Edge": ["get_datastreams", "get_datastream"],
|
|
3659
3904
|
"Datasets": ["get_datasets",
|
|
3905
|
+
"get_batches",
|
|
3906
|
+
"get_batches_errors",
|
|
3660
3907
|
"get_dataset",
|
|
3661
3908
|
"get_datasets_tablenames",
|
|
3662
3909
|
"get_datasets_infos",
|
|
@@ -3684,7 +3931,11 @@ class ServiceShell(cmd.Cmd):
|
|
|
3684
3931
|
"activate_audiences",
|
|
3685
3932
|
"activate_datasets",
|
|
3686
3933
|
"create_dataset_http_source",
|
|
3687
|
-
"get_DLZ_credential"
|
|
3934
|
+
"get_DLZ_credential",
|
|
3935
|
+
"get_landing_zone_tree",
|
|
3936
|
+
"get_landing_zone_folder_infos",
|
|
3937
|
+
"download_landing_zone_file",
|
|
3938
|
+
"upload_file_to_landing_zone"],
|
|
3688
3939
|
"Deletion": ["delete_dataset",
|
|
3689
3940
|
"delete_schema",
|
|
3690
3941
|
"delete_dataflow",
|