Skip to content

Conversation

JenniferWang
Copy link
Contributor

  • Fix the test fixture yaml files
  • Re-write the logic to make the round-trip test compatible with multi-nodes.

Specifically,

  • Move validation function to the policy.py module because @endpoint almost only work with lambda functions.
  • Refactor the test to make setup / tear down clearer

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 9, 2025
@JenniferWang JenniferWang marked this pull request as ready for review October 9, 2025 21:23
@Jack-Khuu
Copy link
Contributor

Can we close #143 once this lands too :)?

)

# Cleanup DCP directory
path = Path(TEST_DCP_DIR)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use TemporaryDirectory which handles this automatically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to change this because NFS does not work for tmp directory

# We only care about the final output
params.output_kind = RequestOutputKind.FINAL_ONLY
return params

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why this has to be in policy.py? Is monarch failing to pickup/serialize the function if it's not in here?
If it has to be here, may be prepend all the functions with _.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, monarch pickled the function with the module path integration_tests but this cannot be resolved in the remote node. Seems that we need to define it in the main modules.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 126 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@2a6e46f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
tests/integration_tests/test_policy_update.py 0.00% 82 Missing ⚠️
src/forge/actors/policy.py 0.00% 44 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #365   +/-   ##
=======================================
  Coverage        ?   63.24%           
=======================================
  Files           ?       78           
  Lines           ?     7725           
  Branches        ?        0           
=======================================
  Hits            ?     4886           
  Misses          ?     2839           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@joecummings joecummings left a comment

Choose a reason for hiding this comment

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

While the test is amazing, having it in the policy.py is not really an option IMO.

From a UX / library perspective, it makes things way more difficult to understand. The argument could be made that directing users to docs alleviates this pain, but 1) our docs are incredibly incomplete and 2) we know from OSS users experience with titan/ tune that most people prefer to just go to the code.

@allenwang28
Copy link
Contributor

While the test is amazing, having it in the policy.py is not really an option IMO.

Oh I completely missed that part. Is it possible to create an inherited Policy that has all of the test functionality and is kept in integration_tests?

I'm not sure I'm clear what the monarch pickling issue is

@joecummings
Copy link
Member

@allenwang28 What are our options here? Surely someone else has tried to run a multi node test via Monarch and not have to clutter up an Actor?

@Jack-Khuu
Copy link
Contributor

Jack-Khuu commented Oct 10, 2025

Wild thought (lmk if this errors): For tests specific methods, can we just append them to the class definition in the test? It's the same idea as inheriting, but let's you surgically change the nested PolicyWorker

Within test:

from foo import Bar

def util(self):
  ...

Bar._special_test_util = util

proxy: Bar = Bar()

I'm not sure I'm clear what the monarch pickling issue is

I'd like to see the trace too since at least 2 others have encountered this when using Monarch/Services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants