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

Should FileStorage.do_store create the outputpath directory ? #635

Closed
huard opened this issue Oct 28, 2021 · 3 comments · Fixed by #636
Closed

Should FileStorage.do_store create the outputpath directory ? #635

huard opened this issue Oct 28, 2021 · 3 comments · Fixed by #636
Labels

Comments

@huard
Copy link
Collaborator

huard commented Oct 28, 2021

Description

I'm a bit confused on whether or not PyWPS is expected to create the outputpath directory if it does not exist.

The documentation says server path where to store output files.

If the directory does not exist, PyPWS fails in this call here
but it feels like this failure could be avoided by computing the free space on the drive where the target resides, or the closest existing parent directory. Later in the code, os.makedirs is called, suggesting an intent to create recursively the target path.

So it's not clear to me exactly what the desired behavior is.

Environment

  • operating system: Ubuntu
  • Python version: 3.9
  • PyWPS version: 4.4
@tlvu
Copy link
Collaborator

tlvu commented Nov 1, 2021

Other than server.outputpath, there are 2 other directories in the wps.cfg config file: server.workdir and server.temp_path that will also need the dir to be created on service startup, if the dir do not already exist.

@cehbrecht
Copy link
Collaborator

In my deployments the Ansible playbook is creating the temp folders with correct permissions. So, the error was avoided.

Would it help to run this code before get_free_space(self.target)?:

if not os.path.exists(self.target):
            os.makedirs(self.target)

@cehbrecht cehbrecht added the bug label Nov 2, 2021
@huard
Copy link
Collaborator Author

huard commented Nov 2, 2021

@cehbrecht Yes, I think so. I was just not sure if recursive directory creation was meant to be supported. If so, I can submit a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants