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

[Mobile Benchmark Test] Add os, job_arn, and job_conclusion to artifact #6371

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

yangw-dev
Copy link
Contributor

@yangw-dev yangw-dev commented Mar 6, 2025

#6294

Details:

  • print os in test spect printout section
  • store os, job_arn (mobile job) and job_conclusion to each artifact metadata. Notice this is not github job conclusion, this is mobile job conclusion.
  • wrap post-test logics into ReportProcessor,
    • pass aws client as parameter for test-driven purpose
    • add unit test for ReportProcessor

Copy link

vercel bot commented Mar 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
torchci ⬜️ Ignored (Inspect) Visit Preview Mar 7, 2025 0:33am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 6, 2025
@yangw-dev yangw-dev changed the title [Test] [Mobile Benchmark Test] Add os, job_arn, and job_conclusion to artifact Mar 6, 2025
@yangw-dev yangw-dev marked this pull request as ready for review March 6, 2025 21:40
@yangw-dev yangw-dev requested review from huydhn, Camyll and ZainRizvi March 6, 2025 21:40
Comment on lines +270 to +272
self.assertEqual(m_df.getMockClient().list_suites.call_count, 2)
self.assertEqual(m_df.getMockClient().list_tests.call_count, 4)
self.assertEqual(download_artifact_mock.call_count, 12)
Copy link
Contributor

Choose a reason for hiding this comment

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

these numbers are very precise and look like they might break the test when the code changes slightly. Can these constraints be relaxed a bit to just checking the most critical api calls and perhaps using greaterThan/lessThan type of comparisons?

The idea is to make the test more resilient to design changes in the code (so that future authors don't have to go around updating a bunch of tests) while still verifying that the core functionality desired is maintained.

self.assertEqual(a2["name"], "test spec output")

@mock.patch("run_on_aws_devicefarm.download_artifact")
def test_reportProcessor_debug(self, download_artifact_mock):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can you please rename this test to match the "test_when_then" format the tests further down have?

That would help explain to future maintainers what exactly this test is intended to validate (which TBH isn't clear to me right now)

Comment on lines +215 to +220
self.assertEqual(m_df.getMockClient().list_suites.call_count, 2)
self.assertEqual(m_df.getMockClient().list_tests.call_count, 4)
self.assertEqual(m_s3.getMockClient().upload_file.call_count, 12)
self.assertEqual(m_s3.getMockClient().upload_file.call_count, 12)
self.assertEqual(download_artifact_mock.call_count, 12)
self.assertEqual(m_s3.getMockClient().upload_file.call_count, 12)
Copy link
Contributor

Choose a reason for hiding this comment

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

same as comment below, about making these more resilient

Comment on lines +453 to +454
run_report = self._to_run_report(report)
self.run_report = run_report
Copy link
Contributor

Choose a reason for hiding this comment

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

very minor nit, but why not:

Suggested change
run_report = self._to_run_report(report)
self.run_report = run_report
self.run_report = self._to_run_report(report)

(feel free to ignore if you prefer the current format)

@@ -196,6 +200,8 @@ def parse_args() -> Any:
help="an optional file to write the list of artifacts from AWS in JSON format",
)

parser.add_argument("--debug", action="store_true")
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I didn't realize until I read your comment later that debug mode doesn't upload the artifacts to S3. This is a nice feature, but I think a help description is needed here to make that clearer. You could also make some parameters like --workflow-id or --workflow-attempt optional in debug mode

Copy link
Contributor

@huydhn huydhn Mar 8, 2025

Choose a reason for hiding this comment

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

On the other hand, another option I think would be useful here is --quiet. I know that I print too many messages like INFO:root:Run mobile-job-android-13711065730-1-2025-03-07-wrRJMDcB in state RUNNING in the console log, which could be silent

project_arn,
unique_prefix,
args.android_instrumentation_test,
args.test_spec,
)

if test_to_run == {}:
Copy link
Contributor

@huydhn huydhn Mar 8, 2025

Choose a reason for hiding this comment

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

Strictly speaking, the test suite is not a requirement because Device Farm can fuzz the app to make sure it doesn't crash. So, only the app is required. All the current use cases on CI need an test suite though, so having this check is ok. However, you could achieve this just by setting required=True in the test_group mutual exclusive group in argparse instead of doing an explicit check here

@huydhn
Copy link
Contributor

huydhn commented Mar 8, 2025

Does the console log from the mobile test jobs look correct https://github.com/pytorch/test-infra/actions/runs/13711065730/job/38347515619?pr=6371?

You could also test this on ExecuTorch side (where it really matters) by quickly submitting a mock PR to ExecuTorch to use your branch addSpec:

@huydhn
Copy link
Contributor

huydhn commented Mar 8, 2025

Look like a small bug on this part https://github.com/pytorch/test-infra/actions/runs/13711065730/job/38347515619?pr=6371#step:15:81, f-string something I guess

INFO:root:{' ' * indent} start gathering artifacts

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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants