Skip to content

Refactor Phase 1: Resolve#162

Closed
nikbpetrov wants to merge 58 commits intoforecastingresearch:mainfrom
nikbpetrov:resolve
Closed

Refactor Phase 1: Resolve#162
nikbpetrov wants to merge 58 commits intoforecastingresearch:mainfrom
nikbpetrov:resolve

Conversation

@nikbpetrov
Copy link
Copy Markdown
Collaborator

Current code runtime: 81mins (fastest job finishes in 41mins)
Refactored code runtime: 78mins (fastest job finishes in 44mins)

Outputs of both jobs (resolution sets and processed forecast sets) are identical, and both match the production data.

IMPORTANT: Before merging rename the job (src/orchestration/Makefile) to func-resolve-forecasts.

Copy link
Copy Markdown
Member

@houtanb houtanb left a comment

Choose a reason for hiding this comment

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

Sending PR now since I might not have time again until the weekend. The big blockers here:

  • can't run tests locally from a clean install
  • it seems like you didn't run orchestration online to ensure it worked as the new resolution file would not have been called by the orchestrator

Comment thread CLAUDE.md Outdated
Comment thread Makefile
Comment thread Makefile Outdated

resolve-forecasts:
$(MAKE) -C src/resolve_forecasts || echo "* $@" >> $(MAKE_FAILURE_LOG)
$(MAKE) -C src/orchestration || echo "* $@" >> $(MAKE_FAILURE_LOG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we spoke about this on Slack, just noting here too to keep the file structure as before. Related from that conversation was to delete all files in src/resolve_forecasts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another note: can you modify .github/workflows/makefile.yml to run tests when a PR is created

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deleted stale files, and also modified the workflows.

Also updated the makefile but not sure how to test that. It's a bit awkward too as my make test activates the .venv but make lint does not. I don't know how you prefer to handle this. I would opt for modifying make lint such that it also activates .venv as if it's activated is not a performance hit at all and adds a layer of safety.

Also, tbh, not 100% sure whether make setup-python-env would run smoothly -- I am guessing there would be a reason you used pip install before, so that makes me a bit hesitant.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feel free to experiment with what works best here.

Comment thread requirements.txt Outdated
Comment thread requirements.txt Outdated
Comment thread src/tests/test_wikipedia.py
Comment thread src/orchestration/func_resolve/Makefile
Comment thread src/orchestration/func_resolve/main.py Outdated
Comment thread src/orchestration/_io.py
Comment thread src/resolve/resolve_all.py Outdated
Comment thread src/resolve/_prepare.py Outdated
Comment thread src/sources/_market.py
Comment thread src/sources/wikipedia.py
Comment thread src/sources/fred.py Outdated
Comment thread src/sources/polymarket.py Outdated
Comment thread src/sources/_market.py Outdated
# Attach warnings for orchestration to send via Slack
if warnings:
existing = df.attrs.get("_resolve_warnings", [])
df.attrs["_resolve_warnings"] = existing + warnings
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of _resolve_warnings and warnings call these _warnings_for_slack to make the different treatment apparent (different as opposed to other warnings/info/error messages that are logged during processing in _resolve() functions).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These functions should perhaps return a (df, slack_warnings) tuple as the attrs could unintentionally be erased on modification of df.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done as requested, though let's circle back eventually, while i prefer the tuple return, it's still a tad wonky looking, I'd prefer to design a dedicated warning/error mechanism that's a bit cleaner than this; perhaps part of a logging module/setup

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree that would be the best solution. Noting that I am concerned a bit with the risk of losing these slack messages. Can you think of a test we can implement to ensure slack warnings are not overwritten in the process.

Comment thread src/sources/wikipedia.py Outdated
@nikbpetrov nikbpetrov force-pushed the resolve branch 2 times, most recently from 18b687d to 98b66c4 Compare March 24, 2026 16:43
@houtanb
Copy link
Copy Markdown
Member

houtanb commented Apr 13, 2026

merged in 7f6c3cd

@houtanb houtanb closed this Apr 13, 2026
@houtanb houtanb linked an issue Apr 16, 2026 that may be closed by this pull request
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.

Refactor codebase

2 participants