Conversation
phargogh
left a comment
There was a problem hiding this comment.
Thanks @emlys ! This looks very good to me. I think pretty much everything I commented on is pretty minor, with I think the biggest question in my mind about the longevity of the polling strategy for checking slurm job status (and also not wanting to overcomplicate things, of course!).
| else: | ||
| LOGGER.debug('Job and post processing completed.') | ||
|
|
||
| return { |
There was a problem hiding this comment.
Is the job result dict's structure defined by pygeoapi? Or is the schema one that we define?
There was a problem hiding this comment.
The elements of this dict are required by pygeoapi. This pygeoapi function expects all these keys to exist. I don't think it's perfect for our use case (for instance, the updated property doesn't really apply), but I filled out all the fields to get it working.
| monitor_thread = threading.Thread( | ||
| target=self.monitor_job_status, | ||
| args=(job_id, workspace_dir, processor.process_output)) |
There was a problem hiding this comment.
At least for testing I'm sure this polling thread is a-ok! But just to confirm my understanding, are we likely to need a different status-checking approach in the near future? Just thinking that if we have enough database connections (perhaps even with worker nodes consuming db connections), we might get into a state where we nee to handle the volume of traffic. I suppose that'll be a good problem to have when we get there!
There was a problem hiding this comment.
Related, I just found out about strigger (docs), in case that helps!
There was a problem hiding this comment.
Oh that's interesting. I'm not sure yet what the maximum number of database connections is, it seems like it would depend on the specific DB configuration that the cluster toolkit is creating for us, which I'm not familiar with.
I guess the number of concurrent jobs is limited by slurm, but it's possible users would request more and we'd get a backlog of pending jobs. strigger looks useful, the callback design could certainly be an improvement over the monitoring thread! I'll make a separate issue for this.
| tuple of extracted json datastack path and model id | ||
| """ | ||
| # Download the datastack from the given URL and | ||
| response = requests.get(datastack_url) |
There was a problem hiding this comment.
In case the datastack is large, might I suggest chunking and streaming the file? Requests has a streaming=true parameter, and if you pair that with iter_content() you can write out the file chunk-by-chunk without exhausting system memory.
There was a problem hiding this comment.
Smart! thanks for the suggestion
There was a problem hiding this comment.
I confess I didn't review this file closely, but given your description of the file, hopefully that's ok? Please let me know if you'd like me to take a close look at this!
.github/workflows/test.yml
Outdated
|
|
||
| - name: Install package | ||
| run: cd invest_processes && pip install . | ||
| run: pip install git+https://github.com/emlys/invest@debug-compute && cd invest_processes && pip install . |
There was a problem hiding this comment.
In case we find it useful to use a fork-and-pull model, would it be worth using git+https://github.com/{{ github.repository }}@debug-compute?
There was a problem hiding this comment.
Oop, I think I can remove this now. The regular natcap.invest from PyPI should work.
Co-authored-by: James Douglass <jdouglass@stanford.edu>
…tcap/invest-compute into feature/compute-note-playbook
|
I think I addressed all your comments so I'll go ahead and merge! |
I'm using Github Actions as a sort of dev environment, since it can easily spin up a slurm cluster for testing, hence all the "debugging" commits. Let's squash this PR when it gets merged.
Sorry this ended up being a bit of a catch-all PR - there's a lot of miscellaneous improvements in here, all in the direction of making the API functional for real clients. Happy to go over it on a call if that's helpful!
pygeoapi server updates
invest_subprocessessubdirectorysacctandscontrol.infrastructure updates
openapi.ymlgenerated by pygeoapi has several issues and doesn't work out of the box.bundled-openapi.ymlincludes some fixes as well as bundling in external specifications. I hope to find a cleaner solution for this eventually. Next step will be defining the API Gateway with terraform.