Skip to content

Commit c91d58e

Browse files
authored
Merge pull request #212932 from elizabethhalper/elhalper/sdutil-tutorial-fixes
SDUTIL Tutorial Fixes
2 parents 8aea69a + 7267043 commit c91d58e

File tree

1 file changed

+126
-92
lines changed

1 file changed

+126
-92
lines changed

articles/energy-data-services/tutorial-seismic-ddms-sdutil.md

Lines changed: 126 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ ms.custom: template-tutorial #Required; leave this attribute/value as-is.
1313

1414
# Tutorial: Seismic store sdutil
1515

16-
A command line python utility designed to easily interact with seismic store.
16+
Sdutil is a command line python utility tool designed to easily interact with seismic store. The seismic store is a cloud-based solution designed to store and manage datasets of any size in the cloud by enabling a secure way to access them through a scoped authorization mechanism. Seismic Store overcomes the object size limitations imposed by a cloud provider by managing generic datasets as multi-independent objects. This provides a generic, reliable, and better performing solution to handle data in cloud storage.
1717

18-
Seismic store is a cloud-based solution designed to store and manage datasets of any size in the cloud by enabling a secure way to access them through a scoped authorization mechanism. Seismic Store overcomes the object size limitations imposed by a cloud provider, by managing generic datasets as multi-independent objects and, therefore, provides a generic, reliable and a better performed solution to handle data on a cloud storage.
19-
20-
The **sdutil** is an intuitive command line utility tool to interact with seismic store and perform some basic operations like upload or download datasets to or from seismic store, manage users, list folders content and more.
18+
**Sdutil** is an intuitive command line utility tool to interact with seismic store and perform some basic operations like upload or download datasets to or from seismic store, manage users, list folders content and more.
2119

2220
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
2321

@@ -40,13 +38,13 @@ Unix
4038
- [64-bit Python 3.8.3](https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz)
4139
- Apple Xcode C++ Build Tools
4240

43-
Other requirements are addressed in the INSTALLATION section below.
41+
Other requirements are addressed in the [installation](#installation) section below.
4442

4543
## Installation
4644

4745
Follow the directions in the sdutil documentation for [running sdutil in Azure environments](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/tree/azure/stable#setup-and-usage-for-azure-env).
4846

49-
The utility requires other modules noted in [requirements.txt](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/blob/azure/stable/requirements.txt). You could either install the modules as is or install them in virtualenv to keep your host clean from package conflicts. if you don't want to install them in a virtual environment jump directly to the step 3.
47+
The utility requires other modules noted in [requirements.txt](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/blob/azure/stable/requirements.txt). You could either install the modules as is or install them in virtualenv to keep your host clean from package conflicts. If you don't want to install them in a virtual environment, jump directly to step 3.
5048

5149
```bash
5250
# check if virtualenv is already installed
@@ -74,13 +72,30 @@ Install required dependencies:
7472

7573
### Configuration
7674

77-
1. Replace/edit `config.yaml` in `sdlib/config.yaml` by this [config-azure.yaml](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/blob/azure/stable/docs/config-azure.yaml)
75+
1. Clone the [sdutil repository](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/tree/azure/stable) and open in your favorite editor.
76+
77+
2. Replace the contents of `config.yaml` in the `sdlib` folder with the following yaml and fill in the three templatized values (two instances of `<meds-instance-url>` and one `<put refresh token here...>`):
7878

79-
2. Update three values in `config.yaml`:
8079
```yaml
81-
- service: '{"Azure": {"azureGlabEnv":{"url": "<base-url-for-microsoft-energy-data-services-instance>/seistore-svc/api/v3", "appkey": ""}}}'
82-
- url: '<base-url-for-microsoft-energy-data-services-instance>/seistore-svc/api/v3'
83-
- "refresh_token": "<refresh-token-for-your-env>"
80+
seistore:
81+
service: '{"azure": {"azureGlabEnv":{"url": "https://<meds-instance-url>/seistore-svc/api/v3", "appkey": ""}}}'
82+
url: 'https://<meds-instance-url>/seistore-svc/api/v3'
83+
cloud_provider: 'azure'
84+
env: 'glab'
85+
auth-mode: 'JWT Token'
86+
ssl_verify: False
87+
auth_provider:
88+
azure: '{
89+
"provider": "azure",
90+
"authorize_url": "https://login.microsoftonline.com/",
91+
"oauth_token_host_end": "/oauth2/token",
92+
"scope_end":"/.default openid profile offline_access",
93+
"redirect_uri":"http://localhost:8080",
94+
"login_grant_type": "refresh_token",
95+
"refresh_token": "<put refresh token here from auth_token.http authorize request>"
96+
}'
97+
azure:
98+
empty: 'none'
8499
```
85100
86101
> [!NOTE]
@@ -96,52 +111,52 @@ Install required dependencies:
96111

97112
### Running the Tool
98113

99-
Run the utility from the extracted utility folder by typing:
114+
1. Run the utility from the extracted utility folder by typing:
100115

101-
```bash
102-
python sdutil
103-
```
116+
```bash
117+
python sdutil
118+
```
104119

105-
If no arguments are specified, this menu will be displayed:
120+
If no arguments are specified, this menu will be displayed:
106121

107-
```code
108-
Seismic Store Utility
109-
110-
> python sdutil [command]
111-
112-
available commands:
113-
114-
* auth : authentication utilities
115-
* unlock : remove a lock on a seismic store dataset
116-
* version : print the sdutil version
117-
* rm : delete a subproject or a space separated list of datasets
118-
* mv : move a dataset in seismic store
119-
* config : manage the utility configuration
120-
* mk : create a subproject resource
121-
* cp : copy data to(upload)/from(download)/in(copy) seismic store
122-
* stat : print information like size, creation date, legal tag(admin) for a space separated list of tenants, subprojects or datasets
123-
* patch : patch a seismic store subproject or dataset
124-
* app : application authorization utilities
125-
* ls : list subprojects and datasets
126-
* user : user authorization utilities
127-
```
122+
```code
123+
Seismic Store Utility
124+
125+
> python sdutil [command]
126+
127+
available commands:
128+
129+
* auth : authentication utilities
130+
* unlock : remove a lock on a seismic store dataset
131+
* version : print the sdutil version
132+
* rm : delete a subproject or a space separated list of datasets
133+
* mv : move a dataset in seismic store
134+
* config : manage the utility configuration
135+
* mk : create a subproject resource
136+
* cp : copy data to(upload)/from(download)/in(copy) seismic store
137+
* stat : print information like size, creation date, legal tag(admin) for a space separated list of tenants, subprojects or datasets
138+
* patch : patch a seismic store subproject or dataset
139+
* app : application authorization utilities
140+
* ls : list subprojects and datasets
141+
* user : user authorization utilities
142+
```
128143

129-
At first usage time, the utility required to be initialized by invoking the sdutil config init command.
144+
2. If this is your first time using the tool, you must run the sdutil config init command to initialize the configuration.
130145

131-
```bash
132-
python sdutil config init
133-
```
146+
```bash
147+
python sdutil config init
148+
```
134149

135-
Before start using the utility and perform any operation, you must sign-in the system. When you run the following sign-in command, sdutil will open a sign-in page in a web browser.
150+
3. Before you start using the utility and performing any operations, you must sign in the system. When you run the following sign in command, sdutil will open a sign in page in a web browser.
136151

137-
```bash
138-
python sdutil auth login
139-
```
152+
```bash
153+
python sdutil auth login
154+
```
140155

141-
Once you've successfully logged in, your credentials will be valid for a week. You don't need to sign in again unless the credentials expired (after one week), in this case the system will require you to sign in again.
156+
Once you've successfully logged in, your credentials will be valid for a week. You don't need to sign in again unless the credentials expired (after one week), in this case the system will require you to sign in again.
142157

143-
> [!NOTE]
144-
> If you aren't getting the "sign-in Successful!" message, make sure your three environment variables are set and you've followed all steps in the "Configuration" section above.
158+
> [!NOTE]
159+
> If you aren't getting the "sign in Successful!" message, make sure your three environment variables are set and you've followed all steps in the "Configuration" section above.
145160
146161
## Seistore Resources
147162

@@ -173,7 +188,7 @@ Every resource can be addressed by using the corresponding sdpath section
173188

174189
## Subprojects
175190

176-
A subproject in Seismic Store is a working unit where datasets can be saved. The system can handles multiple subprojects under a tenant project.
191+
A subproject in Seismic Store is a working unit where datasets can be saved. The system can handle multiple subprojects under a tenant project.
177192

178193
A subproject resource can be created by a **Tenant Admin Only** with the following sdutil command:
179194

@@ -192,7 +207,7 @@ A subproject resource can be created by a **Tenant Admin Only** with the followi
192207

193208
## Users Management
194209

195-
To be able to use seismic store, a user must be registered/added to at least a subproject resource with a role that defines their access level. Seismic Store support three different roles scoped at subproject level:
210+
To be able to use seismic store, a user must be registered to at least a subproject resource with a role that defines their access level. Seismic store supports two different roles scoped at subproject level:
196211

197212
- **admin**: read/write access + users management.
198213
- **viewer**: read/list access
@@ -212,7 +227,7 @@ A user can be registered by a **Subproject Admin Only** with the following sduti
212227

213228
## Usage Examples
214229

215-
An example of how to use sdutil to manage datasets with seismic store. For this example, we'll use sd://gtc/carbon as subproject resource
230+
The following is an example of how to use sdutil to manage datasets with the seismic store. For this example, `sd://gtc/carbon` is used as the subproject resource
216231

217232
```bash
218233
# create a new file
@@ -270,41 +285,41 @@ Regression tests
270285

271286
**How can I generate a new utility command?**
272287

273-
run the command generation script (`./command_gen.py`) to automatically generate the base infrastructure for integrate new command in the sdutil utility. A folder with the command infrastructure will be created in sdlib/cmd/new_command_name
288+
Run the command generation script (`./command_gen.py`) to automatically generate the base infrastructure for integrate new command in the sdutil utility. A folder with the command infrastructure will be created in sdlib/cmd/new_command_name
274289

275290
```bash
276291
./scripts/command_gen.py new_command_name
277292
```
278293

279-
How can I delete all files in a directory?
294+
**How can I delete all files in a directory?**
280295

281296
```bash
282297
./sdutil ls -lr sd://tenant/subproject/your/folder/here | xargs -r ./sdutil rm --idtoken=x.xxx.x
283298
```
284299

285300
**How can I generate the utility changelog?**
286301

287-
run the changelog script (`./changelog-generator.sh`) to automatically generate the utility changelog
302+
Run the changelog script (`./changelog-generator.sh`) to automatically generate the utility changelog
288303

289304
```bash
290305
./scripts/changelog-generator.sh
291306
```
292307

293308
## Setup and usage for Microsoft Energy Data Services
294309

295-
Below steps are for windows subsystem linux - ubuntu 20.04
310+
Below steps are for Windows Subsystem for Linux - Ubuntu 20.04
296311
Microsoft Energy Data Services instance is using OSDU&trade; M12 Version of sdutil
297312

298-
- Download the source code from community [sdutil](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/tree/azure/stable/) Azure Stable branch.
313+
1. Download the source code from community [sdutil](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/tree/azure/stable/) Azure Stable branch.
299314

300-
- In case python virtual env isn't installed, use below commands else skip to next section
315+
2. In case python virtual env isn't installed, use below commands. Otherwise, skip to next section
301316

302317
```bash
303318
sudo apt-get update
304319
sudo apt-get install python3-venv
305320
```
306321

307-
- create new venv and install package
322+
3. Create a new virtual environment and install package
308323

309324
```bash
310325
#create new virtual env with name : sdutilenv
@@ -317,62 +332,81 @@ Microsoft Energy Data Services instance is using OSDU&trade; M12 Version of sdut
317332
pip install -r requirements.txt
318333
```
319334

320-
- replace/edit config.yaml in sdlib/config.yaml by this [config-azure.yaml](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-sdutil/-/blob/azure/stable/docs/config-azure.yaml)
335+
4. Replace the contents of `config.yaml` in the `sdlib` folder with the following yaml and fill in the three templatized values (tow `<meds-instance-url>` and `<put refresh token here...>`):
321336

322-
- You need to Update three values in `config.yaml`:
323337
```yaml
324-
- service: '{"Azure": {"azureGlabEnv":{"url": "<base-url-for-microsoft-energy-data-services-instance>/seistore-svc/api/v3", "appkey": ""}}}'
325-
- url: '<base-url-for-microsoft-energy-data-services-instance>/seistore-svc/api/v3'
326-
- "refresh_token": "<refresh-token-for-your-env>"
338+
seistore:
339+
service: '{"azure": {"azureGlabEnv":{"url": "https://<meds-instance-url>/seistore-svc/api/v3", "appkey": ""}}}'
340+
url: 'https://<meds-instance-url>/seistore-svc/api/v3'
341+
cloud_provider: 'azure'
342+
env: 'glab'
343+
auth-mode: 'JWT Token'
344+
ssl_verify: False
345+
auth_provider:
346+
azure: '{
347+
"provider": "azure",
348+
"authorize_url": "https://login.microsoftonline.com/",
349+
"oauth_token_host_end": "/oauth2/token",
350+
"scope_end":"/.default openid profile offline_access",
351+
"redirect_uri":"http://localhost:8080",
352+
"login_grant_type": "refresh_token",
353+
"refresh_token": "<put refresh token here from auth_token.http authorize request>"
354+
}'
355+
azure:
356+
empty: 'none'
327357
```
328-
358+
329359
> [!NOTE]
330360
> Follow the directions in [How to Generate a Refresh Token](how-to-generate-refresh-token.md) to obtain a token if not already present.
331361
332-
- Export or set below environment variables
362+
5. Export or set below environment variables
333363
334364
```bash
335365
export AZURE_TENANT_ID=check-env-provisioning-team-as-specific-to-cluster
336366
export AZURE_CLIENT_ID=check-env-provisioning-team-as-specific-to-cluster
337367
export AZURE_CLIENT_SECRET=check-env-provisioning-team-as-specific-to-cluster
338368
```
339369

340-
- Run below commands to sign-in, list, upload and download
370+
6. Run below commands to sign in, list, upload and download files in the seismic store.
341371

342-
```bash
343-
python sdutil config init
344-
python sdutil auth login
345-
```
372+
- Initialize
346373

347-
- SAMPLE
348-
```code
349-
(sdutilenv) > python sdutil config init
350-
[one] Azure
351-
Select the cloud provider: **enter 1**
352-
Insert the Azure (azureGlabEnv) application key: **just press enter--no need to provide a key**
374+
```code
375+
(sdutilenv) > python sdutil config init
376+
[one] Azure
377+
Select the cloud provider: **enter 1**
378+
Insert the Azure (azureGlabEnv) application key: **just press enter--no need to provide a key**
353379
354-
sdutil successfully configured to use Azure (azureGlabEnv)
380+
sdutil successfully configured to use Azure (azureGlabEnv)
355381
356-
Should display sign-in success message. Credentials expiry set to 1 hour.
357-
```
358-
- list files
382+
Should display sign in success message. Credentials expiry set to 1 hour.
383+
```
359384
360-
```bash
361-
python sdutil ls sd://<tenant> e.g. sd://<datapartition>
362-
python sdutil ls sd://<tenant>/<subproject> e.g. sd://<datapartition>/test
363-
```
385+
- Sign in
364386
365-
- upload file
387+
```bash
388+
python sdutil config init
389+
python sdutil auth login
390+
```
366391
367-
```bash
368-
python sdutil cp local-dir/file-name-at-source.txt sd://<datapartition>/test/file-name-at-destination.txt
369-
```
392+
- List files in your seismic store
370393
371-
- download file
394+
```bash
395+
python sdutil ls sd://<tenant> # e.g. sd://<instance-name>-<datapartition>
396+
python sdutil ls sd://<tenant>/<subproject> # e.g. sd://<instance-name>-<datapartition>/test
397+
```
372398
373-
```bash
374-
python sdutil cp sd://<datapartition>/test/file-name-at-ddms.txt local-dir/file-name-at-destination.txt
375-
```
399+
- Upload a file from your local machine to the seismic store
400+
401+
```bash
402+
python sdutil cp local-dir/file-name-at-source.txt sd://<datapartition>/test/file-name-at-destination.txt
403+
```
404+
405+
- Download a file from the seismic store to your local machine
406+
407+
```bash
408+
python sdutil cp sd://<datapartition>/test/file-name-at-ddms.txt local-dir/file-name-at-destination.txt
409+
```
376410
377411
> [!NOTE]
378412
> Don't use `cp` command to download VDS files. The VDS conversion results in multiple files, therefore the `cp` command won't be able to download all of them in one command. Use either the [SEGYExport](https://osdu.pages.opengroup.org/platform/domain-data-mgmt-services/seismic/open-vds/tools/SEGYExport/README.html) or [VDSCopy](https://osdu.pages.opengroup.org/platform/domain-data-mgmt-services/seismic/open-vds/tools/VDSCopy/README.html) tool instead. These tools use a series of REST calls accessing a [naming scheme](https://osdu.pages.opengroup.org/platform/domain-data-mgmt-services/seismic/open-vds/connection.html) to retrieve information about all the resulting VDS files.

0 commit comments

Comments
 (0)