adobe / adobe/experience-platform-dsw-reference
Authentication Error in Datasaver.py
- Dominant language
- Python
- Stars
- 21
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
### Expected Behaviour
I have been playing with the Recipe Builder using the sample codes and the sample Retail Sale dataset, at the jupyterLab on UI: https://platform.adobe.com/notebooks/jupyterLab
The sample datasaver code is expected to work without issues.
Here is the datasaver code:
`def save(config_properties, prediction):
client_context = get_client_context(config_properties)
dataset = Dataset(client_context).get_by_id(config_properties['scoringResultsDataSetId'])
dataset_writer = DatasetWriter(client_context, dataset)
dataset_writer.write(prediction, file_format='json')
print("Datasaver Finish")`
### Actual Behaviour
The line below throws an error
`dataset_writer.write(prediction, file_format='json')`
The error is around authentication:
Traceback (most recent call last):
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/ml_runtime_python-0.33.3-py3.5.egg/__main__.py", line 3, in
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/ml_runtime_python-0.33.3-py3.5.egg/ml/runtime/python/main/main.py", line 63, in main
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/ml_runtime_python-0.33.3-py3.5.egg/ml/runtime/python/core/scoringInitiator.py", line 76, in initiate
File "dist/recipe-0.0.1-py3.5.egg/recipe/datasaver.py", line 20, in save
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/platform_sdk/dataset_writer.py", line 60, in write
file_path = common_adl_access._get_file_path(self.dataset_id(), batch_id, view_id)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/platform_sdk/common_adl_client.py", line 55, in _get_file_path
self._data_set_info(data_set_id)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/platform_sdk/common_adl_client.py", line 52, in _data_set_info
self._adl_client = ADLClient(data_set_id, credential_response)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/platform_sdk/adl.py", line 45, in __init__
resource = ADL_RESOURCE_URL)
File "/opt/conda/envs/usermlruntimepython/lib/python3.5/site-packages/azure/datalake/store/lib.py", line 118, in auth
raise ValueError("tenant_id and client_id must be supplied for authentication")
ValueError: tenant_id and client_id must be supplied for authentication
Then I generated the tenantId via following curl command
`curl -X GET \
https://platform.adobe.io/data/foundation/schemaregistry/stats \
-H 'Authorization: [Bearer token] \
-H 'x-api-key: [api key]' \
-H 'x-gw-ims-org-id: [imsorg id]'`
I added it to the scoring configuration file scoring.conf with key "tenantId", but still the error persists and I don't know how to pass client_id for authentication.
### Reproduce Scenario (including but not limited to)
Click "Score" button on the Recipe Builder page. The error shows up when saving the prediction to the scoring output.
#### Steps to Reproduce
Click "Score" button on the Recipe Builder page.
#### Platform and Version
Adobe Experience Platform/Data Science Workspace.
#### Sample Code that illustrates the problem
#### Logs taken while reproducing problem
Contributor guide
Research direction
Start with recipe/datasaver.py and the scoring.conf configuration used by the Recipe Builder, then reproduce the failure by clicking Score. Trace the dataset_writer.write call through the authentication error; done means the sample prediction saves successfully without the missing tenant_id and client_id error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100