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

[tfjs-data] Bazel migration for tfjs-data #5748

Merged
merged 12 commits into from Oct 21, 2021
Merged

[tfjs-data] Bazel migration for tfjs-data #5748

merged 12 commits into from Oct 21, 2021

Conversation

pyu10055
Copy link
Collaborator

@pyu10055 pyu10055 commented Oct 19, 2021

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@google-cla google-cla bot added the cla: yes label Oct 19, 2021
Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

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

Thanks! I have a few comments. I'll test the build on Windows, and I'll test the output of the build (non-Windows) on tfjs-models (speech commands).

Reviewed 15 of 18 files at r1, 3 of 5 files at r2, 3 of 4 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: 0 of 1 approvals obtained (waiting on @pyu10055)


tfjs-data/BUILD.bazel, line 33 at r1 (raw file):

  ":package_json",

This might not be necessary. I removed it and the tests passed.


tfjs-data/BUILD.bazel, line 38 at r1 (raw file):

   link_workspace_root = True,

This also might not be necessary. Tests passed without it.

link_workspace_root allows absolute requires from the workspace root, like import * as foo from tfjs/tfjs-core/src/index.


tfjs-data/BUILD.bazel, line 48 at r1 (raw file):

        ":tsconfig.json",

Might not need this. It still runs 15 snippets without it.


tfjs-data/BUILD.bazel, line 55 at r1 (raw file):

    link_workspace_root = True,

Might not need this either. Still runs 15 snippets without it.


tfjs-data/BUILD.bazel, line 141 at r4 (raw file):

Quoted 7 lines of code…
js_library(
    name = "package_json",
    package_name = "tfjs-data",
    srcs = [
        ":package.json",
    ],
)

This might not be necessary if there's no version test. Tests passed without it (after removing it from the rules that depended on it).


tfjs-data/cloudbuild.yml, line 5 at r4 (raw file):

Quoted 5 lines of code…
# Install common dependencies.
- name: 'gcr.io/learnjs-174218/release'
  entrypoint: 'yarn'
  id: 'yarn-common'
  args: ['install']

This can be removed since it's only necessary when this cloudbuild file is run on its own, and we don't do that anymore.


tfjs-data/package.json, line 60 at r1 (raw file):

:tfjs-data_webgl2_test

:tfjs-data_browser_test


tfjs-data/package.json, line 62 at r4 (raw file):

"test-dev": "bazel test tfjs-data_test"

Nit: Should this be called "test-node"? We could add another "test-dev" target that uses the same command except with "ibazel", which automatically re-runs tests when inputs change (more of a "dev" experience).

Thinking about developer experience, we might also want targets for debugging the tests.

bazel run :tfjs-data_test --config=debug launches node and waits for a debugger to connect before running.
bazel run :tfjs-data_browser_test launches browser tests without starting them and waits for the user to click "debug".

(unfortunately, we can't just tell users to pass--config=debug whenever they want to debug becaues if you pass it to karma browser tests, that will debug the karma process instead of the tests in the browser)


tfjs-data/src/BUILD.bazel, line 110 at r4 (raw file):

        "@tensorflow/tfjs",
        "worker_threads",
        "util",

I had to add "fs" and "buffer" here as well.


tfjs-data/src/BUILD.bazel, line 116 at r4 (raw file):

        "//tfjs-data:package_json",

Might not need this


tfjs-data/src/util/deep_map.ts, line 100 at r4 (raw file):

    if (input.__proto__) {
      mappedIterable.__proto__ = input.__proto__;
    }

Nit: This looks like a change that should be tested, unless deep_map itself is only used for testing.

@mattsoulanille
Copy link
Member

Build and test worked on Windows (after rebasing #5745 on top of this PR).

Copy link
Collaborator Author

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 approvals obtained (waiting on @mattsoulanille)


tfjs-data/BUILD.bazel, line 33 at r1 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
  ":package_json",

This might not be necessary. I removed it and the tests passed.

Done.


tfjs-data/BUILD.bazel, line 38 at r1 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
   link_workspace_root = True,

This also might not be necessary. Tests passed without it.

link_workspace_root allows absolute requires from the workspace root, like import * as foo from tfjs/tfjs-core/src/index.

Done.


tfjs-data/BUILD.bazel, line 48 at r1 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
        ":tsconfig.json",

Might not need this. It still runs 15 snippets without it.

Done.


tfjs-data/BUILD.bazel, line 55 at r1 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
    link_workspace_root = True,

Might not need this either. Still runs 15 snippets without it.

Done.


tfjs-data/BUILD.bazel, line 141 at r4 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
js_library(
    name = "package_json",
    package_name = "tfjs-data",
    srcs = [
        ":package.json",
    ],
)

This might not be necessary if there's no version test. Tests passed without it (after removing it from the rules that depended on it).

Done.


tfjs-data/cloudbuild.yml, line 5 at r4 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
# Install common dependencies.
- name: 'gcr.io/learnjs-174218/release'
  entrypoint: 'yarn'
  id: 'yarn-common'
  args: ['install']

This can be removed since it's only necessary when this cloudbuild file is run on its own, and we don't do that anymore.

Done.


tfjs-data/package.json, line 60 at r1 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
:tfjs-data_webgl2_test

:tfjs-data_browser_test

Done.


tfjs-data/src/BUILD.bazel, line 110 at r4 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…

I had to add "fs" and "buffer" here as well.

Done.


tfjs-data/src/BUILD.bazel, line 116 at r4 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
        "//tfjs-data:package_json",

Might not need this

Done.


tfjs-data/src/util/deep_map.ts, line 100 at r4 (raw file):

Previously, mattsoulanille (Matthew Soulanille) wrote…
    if (input.__proto__) {
      mappedIterable.__proto__ = input.__proto__;
    }

Nit: This looks like a change that should be tested, unless deep_map itself is only used for testing.

test added.

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just one typo in the package.json that should be fixed before submitting. Thanks!

Reviewed 5 of 5 files at r5, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @pyu10055)


tfjs-data/package.json, line 60 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

Done.

The first t was accidentally deleted, I think.


tfjs-data/src/util/deep_map.ts, line 100 at r4 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

test added.

Thanks!

@mattsoulanille
Copy link
Member

I was wrong about omitting tfjs-data/tsconfig.json from snippets tests. They fail in CI without it.

@pyu10055 pyu10055 merged commit 1707ea5 into master Oct 21, 2021
@pyu10055 pyu10055 deleted the bazel-data branch October 21, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants