Skip to content

fixed get_images_runner2 to use vosHandler - #365

Merged
sfarrens merged 2 commits into
masterfrom
vos_check_sf
Jan 7, 2021
Merged

sfarrens merged 2 commits into
masterfrom
vos_check_sf

Conversation

@sfarrens

@sfarrens sfarrens commented Jan 6, 2021

Copy link
Copy Markdown
Member

Summary

  • Resolves vos import #364
  • Updated get_images_runner2.py to use vosHandler from canfar.py
  • Improved _check_vos_install error message in vosHandler

Notes

The VOS import error is only raised when a vosHandler object is instantiated. Provided this is done only when VOS is expected to be installed there should be no issues.

@sfarrens sfarrens added the bug Something isn't working label Jan 6, 2021
@sfarrens sfarrens added this to the General Improvements milestone Jan 6, 2021
@sfarrens sfarrens self-assigned this Jan 6, 2021
@sfarrens sfarrens mentioned this pull request Jan 6, 2021

@martinkilbinger martinkilbinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I still have the following problem: I want to use this module with the option retrieve = 'symlink' (condition line 162). It currently gives still an import/depencensy error if I don't install shapepipe with --vos.

It would be good if that worked on machines where the data is already downloaded, and for some reason vos cannot be installed. But not high priority.

@sfarrens

sfarrens commented Jan 7, 2021 •

Copy link
Copy Markdown
Member Author

@martinkilbinger Can you let me know exactly what you are doing to test this?

I have ShapePipe installed without VOS and I get the following:

Using the symlink option

>>> from shapepipe.modules.get_images_runner import GetImages
>>> x = GetImages(copy='symlink', options=None, image_number_list=['1'], input_numbering='\d{3}\.\d{3}', input_file_pattern=['CFIS.000.000.r', 'CFIS.000.000.r.weight'], input_file_ext=['.fits', '.fits.fz'], w_log=None, check_existing_dir=None)
>>> x.copy_one('./', './dummy1')

No error as expected.

Using the vos option

>>> from shapepipe.modules.get_images_runner import GetImages
>>> x = GetImages(copy='vos', options=None, image_number_list=['1'], input_numbering='\d{3}\.\d{3}', input_file_pattern=['CFIS.000.000.r', 'CFIS.000.000.r.weight'], input_file_ext=['.fits', '.fits.fz'], w_log=None, check_existing_dir=None)
>>> x.copy_one('./', './dummy2')
...
ImportError: vos package not found, re-install ShapePipe with './install_shapepipe --vos'

Raises error as expected.

Note that I get the same behaviour from get_images_runner2.

@martinkilbinger

Copy link
Copy Markdown
Contributor

@martinkilbinger Can you let me know exactly what you are doing to test this?

I have ShapePipe installed without VOS and I get the following:

Using the symlink option

>>> from shapepipe.modules.get_images_runner import GetImages
>>> x = GetImages(copy='symlink', options=None, image_number_list=['1'], input_numbering='\d{3}\.\d{3}', input_file_pattern=['CFIS.000.000.r', 'CFIS.000.000.r.weight'], input_file_ext=['.fits', '.fits.fz'], w_log=None, check_existing_dir=None)
>>> x.copy_one('./', './dummy1')

No error as expected.

Using the vos option

>>> from shapepipe.modules.get_images_runner import GetImages
>>> x = GetImages(copy='vos', options=None, image_number_list=['1'], input_numbering='\d{3}\.\d{3}', input_file_pattern=['CFIS.000.000.r', 'CFIS.000.000.r.weight'], input_file_ext=['.fits', '.fits.fz'], w_log=None, check_existing_dir=None)
>>> x.copy_one('./', './dummy2')
...
ImportError: vos package not found, re-install ShapePipe with './install_shapepipe --vos'

Raises error as expected.

Note that I get the same behaviour from get_images_runner2.

RIght, so I think the problem then comes from the dependency checker. I get the following error message when I run the pipeline with the get_images_runner2 module:

07/01/2021 12:16:06 Starting ShapePipe Run: run_sp_Git_2021-01-07_12-16-06
07/01/2021 12:16:06 
07/01/2021 12:16:06 Checking Python Dependencies:
07/01/2021 12:16:06 ERROR: Could not import pipeline dependency vos
Traceback (most recent call last):
  File "/local/home/mkilbing/astro/repositories/github/shapepipe/shapepipe/pipeline/dependency_handler.py", line 332, in check_dependencies
    package = importlib.import_module(dependency)
  File "/local/home/mkilbing/miniconda3/envs/shapepipe/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'vos'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/local/home/mkilbing/miniconda3/envs/shapepipe/bin/shapepipe_run", line 418, in main
    pipe.set_up()
  File "/local/home/mkilbing/miniconda3/envs/shapepipe/bin/shapepipe_run", line 58, in set_up
    self._prep_run()
  File "/local/home/mkilbing/miniconda3/envs/shapepipe/bin/shapepipe_run", line 245, in _prep_run
    self._check_dependencies()
  File "/local/home/mkilbing/miniconda3/envs/shapepipe/bin/shapepipe_run", line 164, in _check_dependencies
    for dep in dh.check_dependencies():
  File "/local/home/mkilbing/astro/repositories/github/shapepipe/shapepipe/pipeline/dependency_handler.py", line 335, in check_dependencies
    '{}'.format(dependency))
ImportError: Could not import pipeline dependency vos

@sfarrens

sfarrens commented Jan 7, 2021

Copy link
Copy Markdown
Member Author

@martinkilbinger OK, got it. I just removed VOS from the module runner dependencies defined in the modules. You should not get any errors now (I hope).

If you want the pipeline to report the installed version of VOS I can add something specific to check if it is installed and if so report the version in the log.

@martinkilbinger martinkilbinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sfarrens
sfarrens merged commit f17a271 into master Jan 7, 2021
@sfarrens
sfarrens deleted the vos_check_sf branch January 7, 2021 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vos import

2 participants