Skip to content

Commit

Permalink
Merge pull request #765 from dcs4cop/forman-xxx-log_loading_dyn_cube_…
Browse files Browse the repository at this point in the history
…script

Logging loading of dyn. cube code
  • Loading branch information
forman authored Nov 30, 2022
2 parents e2beabf + 4568cea commit f5a4930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

* xcube server Python scripts can now import modules from
the script's directory.
* Loading of dynamic cubes is now logged.
* xcube serve correctly resolves relative paths to datasets (#758)

## Changes in 0.13.0.dev3
Expand Down
3 changes: 3 additions & 0 deletions xcube/core/mldataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from xcube.constants import FORMAT_NAME_LEVELS
from xcube.constants import FORMAT_NAME_SCRIPT
from xcube.constants import LOG
from xcube.core.dsio import guess_dataset_format
from xcube.core.gridmapping import GridMapping
from xcube.core.schema import rechunk_cube
Expand Down Expand Up @@ -492,6 +493,7 @@ def __init__(self,
script_parent = os.path.dirname(script_path)
if script_parent not in sys.path:
sys.path = [script_parent] + sys.path
LOG.info(f'Python sys.path prepended by {script_parent}')

global_env = dict()
try:
Expand Down Expand Up @@ -521,6 +523,7 @@ def __init__(self,
raise exception_type(f"Invalid in-memory dataset descriptor {ds_id!r}: "
f"Input parameter {input_param_name!r} for callable {callable_name!r} "
f"is not a valid Python identifier")
LOG.info(f'Imported {callable_name}() from {script_path}')
self._callable_name = callable_name
self._callable_obj = callable_obj
self._input_ml_dataset_ids = input_ml_dataset_ids
Expand Down

0 comments on commit f5a4930

Please sign in to comment.