NCAR / wrfcloud

WRF Cloud Framework
Apache License 2.0
14 stars 6 forks source link

Feature 61/wrf jobs in UI #62

Closed hahnd closed 1 year ago

hahnd commented 2 years ago

Closes #61

To test:

  1. Login to the web application and navigate to the WRF Jobs tab.
  2. You should see a table of WRF jobs in the system.
  3. You can update the status with the following Python code. You should immediately see changes in your web application after running the _update_job_insystem function.
    
    import time
    from wrfcloud.system import init_environment
    from wrfcloud.jobs import get_all_jobs_in_system, update_job_in_system, WrfJob
    init_environment('development')
    jobs = get_all_jobs_in_system()
    job1 = jobs[0]

Job is pending

job1.status_message = 'Pending' job1.status_code = WrfJob.STATUS_CODE_PENDING job1.progress = 0 update_job_in_system(job1, True)

you may see some warnings after running this command:

Failed to send message to client: 410

you can ignore these and just make sure your display changed.

the warnings are from clients that have since disconnected.

The client list will be cleaned up when the first message is sent and should not show up in subsequent updates.

Cluster is starting

job1.status_message = 'Initializing Cluster' job1.status_code = WrfJob.STATUS_CODE_STARTING job1.progress = 0 update_job_in_system(job1, True)

Ungrib is running

job1.status_message = 'Running Ungrib' job1.status_code = WrfJob.STATUS_CODE_RUNNING job1.progress = .05 update_job_in_system(job1, True)

WRF is running

job1.status_message = 'Running WRF' job1.progress = .15 update_job_in_system(job1, True)

WRF progresses

for progress in range(16, 115, 15): job1.progress = min(1, progress/100) update_job_in_system(job1, True) time.sleep(.6)

WRF is finished

job1.progress = 1 job1.status_message = 'Finished' job1.status_code = WrfJob.STATUS_CODE_FINISHED update_job_in_system(job1, True)



- [ ] Do these changes modify the system output in any way? **[Yes or No]**</br>
If **yes**, please describe:</br>

## Pull Request Testing ##

- [ ] Describe testing already performed for these changes:</br>

- [ ] Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:</br>

- [ ] Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? **[Yes or No]**

- [ ] Do these changes include sufficient testing updates? **[Yes or No]**

- [ ] Will this PR result in changes to the test suite? **[Yes or No]**</br>
If **yes**, describe the new output and/or changes to the existing output:</br>

- [ ] Please complete this pull request review by **[Fill in date]**.</br>

## Pull Request Checklist ##
- [ ] Review the source issue metadata (labels, project, and milestone).
- [ ] Complete the PR definition above.
- [ ] Ensure the PR title matches the feature or bugfix branch name.
- [ ] Define the PR metadata, as permissions allow.
Select: **Reviewer(s)**
Select: **Project**
Select: **Milestone** as the version that will include these changes
Select: **Development** to link to the original development issue.
- [ ] After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
- [ ] Close the linked issue and delete your feature or bugfix branch from GitHub.
fossell commented 2 years ago

@hahnd - Do need a formal review or user testing for this PR? If not, I can approve and you can merge and continue development as needed. Just let me know.

hahnd commented 2 years ago

@fossell - Just added some testing instructions.