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

Problem: TypeError submitting directory containing zip with delete_packages_after_extraction enabled #404

Open
camlyall opened this issue Oct 6, 2023 · 0 comments

Comments

@camlyall
Copy link
Contributor

camlyall commented Oct 6, 2023

Describe the bug
TypeError when submitting directory containing zip with delete_packages_after_extraction enabled

To Reproduce
Submit a folder containing a zip file with processing configurations extract_packages and delete_packages_after_extraction enabled

Steps to reproduce the behavior:

cd ~

echo "Sample" > sample.txt
mkdir sample
mv sample.txt sample
zip -r sample.zip sample
mv sample.zip sample

git clone https://github.com/artefactual-labs/a3m.git
cd a3m
docker build . -t a3m

docker run --rm --network a3m-network --name a3md --detach --publish 7000:7000 a3m

docker cp ../sample a3md:/a3m

docker run --rm --network a3m-network --name a3mc --interactive --tty --entrypoint=python a3m -m a3m.cli.client --name delete_extracted_test --address=a3md:7000 -p delete_packages_after_extraction=yes -p extract_packages=yes /a3m/sample

# See error: 
docker logs a3md

Expected behavior
Zip file should be extracted and removed.

Additional context
Processing of single zipfile with these config options works fine.
Processing with delete_packages_after_extraction disabled works fine.

The error produced:

Traceback (most recent call last):
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/concurrent/futures/_base.py", line 330, in _invoke_callbacks
    callback(self)
  File "/a3m/a3m/server/queues.py", line 213, in _job_completed_callback
    next_job = future.result()
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/a3m/a3m/server/jobs/client.py", line 106, in run
    self.submit_tasks()
  File "/a3m/a3m/server/jobs/client.py", line 184, in submit_tasks
    for file_replacements in self.package.files(filter_subdir=self.filter_subdir):
  File "/a3m/a3m/server/packages.py", line 299, in files
    file_obj_mapped = get_file_replacement_mapping(
  File "/a3m/a3m/server/packages.py", line 41, in get_file_replacement_mapping
    dirname = os.path.dirname(file_obj.currentlocation)
  File "/home/a3m/.pyenv/versions/3.9.18/lib/python3.9/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
@sevein sevein changed the title TypeError submitting directory containing zip with delete_packages_after_extraction enabled Problem: TypeError submitting directory containing zip with delete_packages_after_extraction enabled Oct 23, 2023
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