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

Fix postprocessing failure on local docker #262

Merged
merged 2 commits into from
Jan 31, 2022
Merged

Conversation

rajeee
Copy link
Contributor

@rajeee rajeee commented Jan 29, 2022

Pull Request Description

The postprocessing was failing on docker because the last PR (#258) was relying in jobx.json files to find out which simulation belonged to which job and finding the total number of upgrades. However, jobx.json files are not available while running locally using docker. This PR addresses that issue by not relying on jobx.json anymore.

Checklist

Not all may apply

  • Code changes (must work)
  • Tests exercising your feature/bug fix (check coverage report on CircleCI build -> Artifacts)
  • All other unit tests passing
  • Update validation for project config yaml file changes
  • Update existing documentation
  • Run a small batch run to make sure it all works (local is fine, unless an Eagle specific feature)
  • Add to the changelog_dev.rst file and propose migration text in the pull request

@rajeee rajeee requested a review from nmerket January 29, 2022 00:34
Copy link
Member

@nmerket nmerket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. One comment below.

Comment on lines 208 to 213
def read_results_json(fs, filename):
def read_results_json(fs, filename, job_id):
with fs.open(filename, 'rb') as f1:
with gzip.open(f1, 'rt', encoding='utf-8') as f2:
dpouts = json.load(f2)
df = pd.DataFrame(dpouts)
# Sorting is needed to ensure all dfs have same column order. Dask will fail otherwise.
df['job_id'] = job_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but wouldn't it be simpler and less error prone to parse out the job id from the filename inside this function rather than to pass it in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it totally would be. I guess your previous implementation polluted my mind into thinking I should calculate them all at once! I will fix this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha. I guess so. Do as I say, not as I do. 😉

results_json_files = fs.glob(f'{sim_output_dir}/results_job*.json.gz')
job_ids = [int(re.search(r'results_job(\d+)\.json\.gz', x).group(1)) for x in results_json_files]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment in the read_results_json function above.

@rajeee rajeee requested a review from nmerket January 31, 2022 16:53
@shorowit
Copy link
Contributor

Ignorant question: Is it possible to create "local docker" CI tests that would catch this issue in the future? It's great that it got caught by the ResStock CI, but ideally it would be caught sooner (i.e., here).

@rajeee
Copy link
Contributor Author

rajeee commented Jan 31, 2022

Ignorant question: Is it possible to create "local docker" CI tests that would catch this issue in the future? It's great that it got caught by the ResStock CI, but ideally it would be caught sooner (i.e., here).

@shorowit I talked about this with @joseph-robertson as well and it seems like a good idea to have those integration tests running for buildstockbatch PR in addition to ResStock PRs. I think this can be a part of a larger discussion on overhauling the CI for BSB that @nmerket is considering.

@nmerket
Copy link
Member

nmerket commented Jan 31, 2022

@shorowit Yes, we should catch this. The way we're doing CI with Circle CI makes it hard to do, but switching to GitHub actions will make this possible. #223 should be the next thing I get to on bsb. Will chat with @joseph-robertson about best practices he's learned there.

@joseph-robertson
Copy link
Contributor

@nmerket @rajeee Is this ready to go?

@nmerket nmerket merged commit 5d654c9 into develop Jan 31, 2022
@nmerket nmerket deleted the fix_docker_fail branch January 31, 2022 22:12
@rajeee rajeee mentioned this pull request Feb 1, 2022
7 tasks
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

Successfully merging this pull request may close these issues.

None yet

4 participants