Commit 6a7fa42a authored by Chad Leong's avatar Chad Leong
Browse files

Merge branch '26-add-logging-for-fileload-convert-command' into 'main'

Add logging to make `fileload convert` command clearer

Closes #26

See merge request osdu/platform/data-flow/data-loading/wellbore-ddms-las-loader!21
parents 6eacba44 a896dc13
Pipeline #73344 passed with stage
in 43 seconds
...@@ -52,25 +52,25 @@ To invoke the CLI using the virtual environment and from within the `src` folder ...@@ -52,25 +52,25 @@ To invoke the CLI using the virtual environment and from within the `src` folder
``` ```
pipenv run python -m lascli <group> <command> <options> pipenv run python -m lascli <group> <command> <options>
``` ```
Available groups are `fileload` and `list`. Help can be obtained with the `-h` option. Available groups are `fileload`, `ingest`, `list` and `download`. Help can be obtained with the `-h` option.
``` ```
pipenv run python -m lascli -h pipenv run python -m lascli -h
pipenv run python -m lascli fileload -h pipenv run python -m lascli fileload -h
pipenv run python -m lascli fileload ingest -h pipenv run python -m lascli fileload convert -h
``` ```
A token is required to access an OSDU instance. The `-t/--token` option is used to specify the token, this is a string. As tokens are long strings we recommend that the token is stored in an environment variable. For example, on a Windows PowerShell prompt: A token is required to access an OSDU instance. The `-t/--token` option is used to specify the token, this is a string. As tokens are long strings we recommend that the token is stored in an environment variable. For example, on a Windows PowerShell prompt:
``` ```
set OSDUTOKEN <token> set OSDUTOKEN <token>
pipenv run python -m lascli fileload ingest -t $OSDUTOKEN pipenv run python -m lascli ingest wellbore -t $OSDUTOKEN
``` ```
Or windows command prompt Or Windows command prompt
``` ```
set OSDUTOKEN=<token> set OSDUTOKEN=<token>
pipenv run python -m lascli fileload ingest -t %OSDUTOKEN% pipenv run python -m lascli ingest wellbore -t %OSDUTOKEN%
``` ```
This keeps the command line short. This keeps the command line short. This can also be done for other commonly used options (e.g. `-u/--url`).
### Config file ### Config file
......
...@@ -35,10 +35,15 @@ def convert(input_path: str, config_path: str, wellbore_id: str): ...@@ -35,10 +35,15 @@ def convert(input_path: str, config_path: str, wellbore_id: str):
config = Configuration(LocalFileLoader(), config_path) config = Configuration(LocalFileLoader(), config_path)
mapper = LasToRecordMapper(las_data, config) mapper = LasToRecordMapper(las_data, config)
logger.info("Mapping LAS file to wellbore and well log records.")
wellbore_record = mapper.map_to_wellbore_record() wellbore_record = mapper.map_to_wellbore_record()
welllog_record = mapper.map_to_well_log_record(wellbore_id) welllog_record = mapper.map_to_well_log_record(wellbore_id)
path = Path(input_path) path = Path(input_path)
writer = JsonToFile() writer = JsonToFile()
logger.info("Writing wellbore and well log records to JSON files.")
writer.write(vars(wellbore_record), path.with_suffix('.wellbore.json')) writer.write(vars(wellbore_record), path.with_suffix('.wellbore.json'))
logger.warning(f"Wellbore record file created: {path.with_suffix('.wellbore.json')}")
writer.write(vars(welllog_record), path.with_suffix('.welllog.json')) writer.write(vars(welllog_record), path.with_suffix('.welllog.json'))
logger.warning(f"Well log record file created: {path.with_suffix('.welllog.json')}")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment