Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Unable to acquire lock on filepath #36

Open
tommylees112 opened this issue Jul 31, 2019 · 0 comments
Open

RuntimeError: Unable to acquire lock on filepath #36

tommylees112 opened this issue Jul 31, 2019 · 0 comments

Comments

@tommylees112
Copy link

We are using your package to download SRTM data for kenya

Hopefully I can spare some of the details (the functions shown but not explained hopefully have somewhat intuitive sounding names) but this is where / how we are using your package:

    def export(self, region_name: str = 'kenya',
               product: str = 'SRTM3',
               max_download_tiles: int = 15) -> None:
        """
        Export SRTm topography data

        Arguments
        ----------
        region_name: str = 'kenya'
            The region to download. Must be one of the regions in the
            region_lookup dictionary
        product: {'SRTM1', 'SRTM3'} = 'SRTM3'
            The product to download the data from
        max_download_tiles: int = 15
            By default, the elevation package doesn't allow more than 9
            tiles to be downloaded. Kenya is 12 tiles - this increases the
            limit to allow Kenya to be downloaded
        """

        region = region_lookup[region_name]

        output_tif = self.output_folder / f'{region_name}.tif'

        if not output_tif.exists():
            print(f'Downloading tiles. Saving as tif to {output_tif}')
            try:
                elevation.clip(bounds=self._region_to_tuple(region),  # type: ignore
                               output=output_tif.resolve().as_posix(),
                               product=product,
                               max_download_tiles=max_download_tiles)
            except Exception as e:
                print(e)

            elevation.clean()  # type: ignore

        output_nc = self.output_folder / f'{region_name}.nc'

        if not output_nc.exists():
            print(f'Converting {output_tif} to NetCDF format ({output_nc})')
            self._tif_to_nc(output_tif, output_nc)

We get the following error message on a remote cluster. Is this something you have seen before?

(crp) chri4118@linux8:/soge-home/projects/crop_yield/ml_drought/scripts$ python export.py
The SRTM exporter requires GDAL and the elevation python package. The mac conda environment contains them.In addition, a (finnicky) ubuntu environment contains them in environment.ubuntu.cpu.gdal.yml
Downloading tiles. Saving as tif to ../data/raw/srtm/kenya.tif
Unable to acquire lock on `b'/soge-home/users/chri4118/.cache/elevation/SRTM3/.folder_lock'` due to [Errno 38] Function not implemented
Traceback (most recent call last):
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 99, in _try_acquire
    self.trylock()
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 217, in trylock
    self._trylock(self.lockfile)
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 250, in _trylock
    fcntl.lockf(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
OSError: [Errno 38] Function not implemented

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "export.py", line 83, in <module>
    export_srtm()
  File "export.py", line 74, in export_srtm
    exporter.export()
  File "../src/exporters/srtm.py", line 77, in export
    elevation.clean()  # type: ignore
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/elevation/datasource.py", line 201, in clean
    datasource_root, _ = ensure_setup(cache_dir, product)
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/elevation/datasource.py", line 122, in ensure_setup
    util.ensure_setup(datasource_root, product=product, force=force, **spec)
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/elevation/util.py", line 69, in ensure_setup
    with fasteners.InterProcessLock(os.path.join(root, FOLDER_LOCKFILE_NAME)):
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 179, in __enter__
    gotten = self.acquire()
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 161, in acquire
    gotten = r(self._try_acquire, blocking, watch)
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/_utils.py", line 121, in __call__
    return fn(*args, **kwargs)
  File "/soge-home/users/chri4118/.conda/envs/crp/lib/python3.7/site-packages/fasteners/process_lock.py", line 112, in _try_acquire
    'exception': e,
RuntimeError: Unable to acquire lock on `b'/soge-home/users/chri4118/.cache/elevation/SRTM1/.folder_lock'` due to [Errno 38] Function not implemented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant