Skip to content
Snippets Groups Projects
Commit 0aa36917 authored by Maciej Wielgosz's avatar Maciej Wielgosz
Browse files

oracle wrapper - reading input from env vars

parent cca432fa
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ import sys ...@@ -8,6 +8,7 @@ import sys
import json import json
import shutil import shutil
import yaml import yaml
from urllib.parse import urlparse
from pathlib import Path from pathlib import Path
from oci.config import validate_config from oci.config import validate_config
from oci.object_storage import ObjectStorageClient from oci.object_storage import ObjectStorageClient
...@@ -24,15 +25,24 @@ def run_oracle_wrapper(path_to_config_file): ...@@ -24,15 +25,24 @@ def run_oracle_wrapper(path_to_config_file):
# create the client # create the client
client = ObjectStorageClient(config) client = ObjectStorageClient(config)
# get the namespace # read system environment variables
namespace = client.get_namespace().data input_location = os.environ['OBJ_INPUT_LOCATION']
# get the bucket name if input_location is not None:
bucket_name = 'bucket_lidar_data' print('Taking the input from the location ' + input_location)
parsed_url = urlparse(input_location)
# folder name inside the bucket input_folder_in_bucket = parsed_url.path[1:]
bucket_name = parsed_url.netloc.split('@')[0]
input_folder_in_bucket = 'geoslam' namespace = parsed_url.netloc.split('@')[1]
else:
print('Taking the input from the default location')
# get the namespace
namespace = client.get_namespace().data
# get the bucket name
bucket_name = 'bucket_lidar_data'
# folder name inside the bucket
input_folder_in_bucket = 'geoslam'
# read the config file from config folder # read the config file from config folder
with open(path_to_config_file) as f: with open(path_to_config_file) as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment