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

download inform / progress #18

Open
landam opened this issue May 25, 2021 · 6 comments
Open

download inform / progress #18

landam opened this issue May 25, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request
Projects
Milestone

Comments

@landam
Copy link
Contributor

landam commented May 25, 2021

Inform user about download data.

Option 1: "Downloading output data, please wait ..."

Option 2: "Downloading data 5%..."

@landam landam added the enhancement New feature or request label May 25, 2021
@landam landam added this to the Version 1.0 milestone May 25, 2021
@jachym
Copy link
Contributor

jachym commented Jun 18, 2021

At the moment, the files are downloaded with help of OWLib, which has not so nice implementation of file download:

  1. It loads content of the response to the memory (could potentially crash the client machine)
  2. it downloads the data not in chunks, but in one request

Suggestion:

Rewrite OWSLib, https://github.com/geopython/OWSLib/blob/51df57989877670b7a19f633f04a4b8cf774d9f1/owslib/wps.py#L1483 so it uses something like

        # write out content
                if content is not None:
                    if self.fileName == "":
                        self.fileName = self.identifier
                    self.filePath = path + self.fileName
                    with open(self.filePath, 'wb') as out:
                         data = content.read(8192)
                         while data:
                                  out.write(data)
                                  data = content.read(8192)

and using something like

def write_file():
    chunk = 0
    with open("output.bin", "wb") as out:
        with open("/dev/random", "rb") as inpt:
            data = inpt.read(1024)
            while data and chunk <= 10:
                out.write(data)
                data = inpt.read(1024)
                chunk += 1
                yield chunk

for i in write_file():
    print(i)

construction - yield generator output could be then passed to the progressbar dialog

Same applies for https://github.com/geopython/OWSLib/blob/51df57989877670b7a19f633f04a4b8cf774d9f1/owslib/wps.py#L902

@jachym
Copy link
Contributor

jachym commented Jul 5, 2021

done in the 18_progress branch

But you have to use https://github.com/jachym/owslib/tree/782_wps_download branch

@landam landam linked a pull request Jul 7, 2021 that will close this issue
@landam
Copy link
Contributor Author

landam commented Jul 13, 2021

@jachym Tested on http://lincalc-02.fsv.cvut.cz/services/wps

start: 01/01/2018
end 10/01/2018

No data downloaded, process finished on server. Client frozen.

Screenshot from 2021-07-13 13-53-29

@jachym jachym added this to In progress in Workflow Aug 17, 2021
@landam
Copy link
Contributor Author

landam commented Nov 11, 2021

Service for testing: http://157.90.183.85:8080/services/wps

@landam
Copy link
Contributor Author

landam commented Nov 11, 2021

Result of testing: no download progress show

@landam
Copy link
Contributor Author

landam commented Nov 19, 2021

See related PR: geopython/OWSLib#784

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Workflow
In progress
Development

Successfully merging a pull request may close this issue.

2 participants