Skip to content

Commit

Permalink
Issue #275 TODO-mark some places with hardcoded VITO references to el…
Browse files Browse the repository at this point in the history
…iminate
  • Loading branch information
soxofaan committed Mar 20, 2024
1 parent 0873eee commit 39dfaa4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions openeo_driver/ProcessGraphDeserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ def _align_extent(extent,collection_id,env):
except CollectionNotFoundException:
pass

# TODO #275 eliminate this VITO specific handling?
if metadata is None or metadata.get("_vito") is None or not metadata.get("_vito").get("data_source", {}).get("realign", False):
return extent

Expand Down Expand Up @@ -574,6 +575,7 @@ def load_collection(args: dict, env: EvalEnv) -> DriverDataCube:
return dry_run_tracer.load_collection(collection_id=collection_id, arguments=arguments, metadata=metadata)
else:
# Extract basic source constraints.
# TODO #275: eliminate this VITO specific handling?
properties = {**CollectionMetadata(metadata).get("_vito", "properties", default={}),
**arguments.get("properties", {})}

Expand Down
6 changes: 3 additions & 3 deletions openeo_driver/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class BatchJobs(MicroService):
ASSET_PUBLIC_HREF = "public_href"

def __init__(self):
# TODO this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
# TODO #275 this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
self._get_proxy_user: Callable[[User], Optional[str]] = lambda user: None

def create_job(
Expand Down Expand Up @@ -503,7 +503,7 @@ def delete_job(self, job_id: str, user_id: str):
"""
raise NotImplementedError

# TODO this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
# TODO #275 this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
def get_proxy_user(self, user: User) -> Optional[str]:
return self._get_proxy_user(user)

Expand Down Expand Up @@ -750,7 +750,7 @@ def visit_process_graph(self, process_graph: dict) -> ProcessGraphVisitor:
def summarize_exception(self, error: Exception) -> Union[ErrorSummary, Exception]:
return error

# TODO this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
# TODO #275 this "proxy user" feature is YARN/Spark/VITO specific. Move it to oppeno-geopyspark-driver?
def set_preferred_username_getter(self, getter: Callable[[User], Optional[str]]):
self.batch_jobs.set_proxy_user_getter(getter)

Expand Down
3 changes: 2 additions & 1 deletion openeo_driver/dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def process_traces(self, traces: List[DataTraceBase], operation: str, arguments:

def load_collection(self, collection_id: str, arguments: dict, metadata: dict = None) -> 'DryRunDataCube':
"""Create a DryRunDataCube from a `load_collection` process."""
# TODO: avoid VITO/Terrascope specific handling here?
# TODO #275 avoid VITO/Terrascope specific handling here?
properties = {**CollectionMetadata(metadata).get("_vito", "properties", default={}),
**arguments.get("properties", {})}

Expand Down Expand Up @@ -721,6 +721,7 @@ def atmospheric_correction(
elevation_model: Optional[str] = None,
options: Optional[dict] = None,
) -> "DriverDataCube":
# TODO #275 does this VITO reference belong here?
method_link = "https://remotesensing.vito.be/case/icor"
if method == "SMAC":
method_link = "https://doi.org/10.1080/01431169408954055"
Expand Down
3 changes: 2 additions & 1 deletion openeo_driver/jobregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ def _parse_cli(self) -> argparse.Namespace:
return cli.parse_args()

def _get_job_registry(self, setup_auth=True, cli_args: Optional[argparse.Namespace] = None) -> ElasticJobRegistry:
# TODO #275 avoid hardcoded VITO reference, instead require env var or cli option?
api_url = self.environ.get("OPENEO_EJR_API", "https://jobregistry.vgt.vito.be")
if "backend_id" in cli_args and cli_args.backend_id:
backend_id = cli_args.backend_id
Expand Down Expand Up @@ -716,7 +717,7 @@ def _get_job_registry(self, setup_auth=True, cli_args: Optional[argparse.Namespa
vault_client = hvac.Client(url=self.environ.get("VAULT_ADDR"))
ejr_vault_path = self.environ.get(
"OPENEO_EJR_CREDENTIALS_VAULT_PATH",
# TODO: eliminate this hardcoded VITO specific default value
# TODO #275 eliminate this hardcoded VITO specific default value
"TAP/big_data_services/openeo/openeo-job-registry-elastic-api",
)
secret = vault_client.secrets.kv.v2.read_secret_version(
Expand Down
2 changes: 1 addition & 1 deletion openeo_driver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ def _s3_client():
# We want to avoid unnecessary dependencies. (And dependencies of dependencies!)
import boto3

# TODO: Get these credentials/secrets from VITO TAP vault instead of os.environ
# TODO: Get these credentials/secrets from config instead of os.environ
aws_access_key_id = os.environ.get("SWIFT_ACCESS_KEY_ID", os.environ.get("AWS_ACCESS_KEY_ID"))
aws_secret_access_key = os.environ.get("SWIFT_SECRET_ACCESS_KEY", os.environ.get("AWS_SECRET_ACCESS_KEY"))
swift_url = os.environ.get("SWIFT_URL")
Expand Down

0 comments on commit 39dfaa4

Please sign in to comment.