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

Adds comet-ml plugin #2550

Merged
merged 8 commits into from
Jul 17, 2024

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Jul 3, 2024

Why are the changes needed?

This PR adds a comet-ml plugin to flytekit.

What changes were proposed in this pull request?

This PR adds a comet_ml_init task decorator that adds a link to the Comet's platform.

How was this patch tested?

Unit tests were added to this PR.

Screenshots

Screenshot 2024-07-02 at 11 02 07 PM

Related PRs

Related to #2405

Docs link

I also added an example in flytesnacks: flyteorg/flytesnacks#1702

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.41%. Comparing base (876877a) to head (58b33b0).
Report is 20 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2550       +/-   ##
===========================================
+ Coverage   52.89%   90.41%   +37.52%     
===========================================
  Files         297       60      -237     
  Lines       23957     3058    -20899     
  Branches     3655        0     -3655     
===========================================
- Hits        12671     2765     -9906     
+ Misses      11178      293    -10885     
+ Partials      108        0      -108     

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

# For local execution, always use the experiment_key. If `self.experiment_key` is `None`, comet_ml
# will generate it's own key
if self.experiment_key is not None:
init_kwargs["experiment_key"] = self.experiment_key
Copy link
Contributor

Choose a reason for hiding this comment

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

is api key not required for local executions?

Copy link
Member

Choose a reason for hiding this comment

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

It's required, I use export COMET_API_KEY="xxxx" to test it in local execution.

raise ValueError("project_name must be set")
if workspace is None:
raise ValueError("workspace must be set")
if secret is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't secret be made optional as it isn't necessary when executing locally?

Copy link
Member Author

@thomasjpfan thomasjpfan Jul 17, 2024

Choose a reason for hiding this comment

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

The secret field is ignored during location execution, but required during remote. One still needs export COMET_API_KEY= for local execution.

If this was optional, we'll catch the "no secret" during execution and not at registration time. I do not want to wait until then, because these experiments can use GPUs and waiting & spinning up a GPU just to see this error is not efficient and a worst DevX.

By making secret required, I am optimizing for "failing quickly" for remote execution.

dynamic-log-links:
- comet-ml-execution-id:
displayName: Comet
templateUris: {{ .taskConfig.host }}/{{ .taskConfig.workspace }}/{{ .taskConfig.project_name }}/{{ .executionName }}{{ .nodeId }}{{ .taskRetryAttempt }}{{ .taskConfig.link_suffix }}
Copy link
Member

@Future-Outlier Future-Outlier Jul 17, 2024

Choose a reason for hiding this comment

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

we should use double quote here, right?

templateUris: {{ .taskConfig.host }}/{{ .taskConfig.workspace }}/{{ .taskConfig.project_name }}/{{ .executionName }}{{ .nodeId }}{{ .taskRetryAttempt }}{{ .taskConfig.link_suffix }}
- comet-ml-custom-id:
displayName: Comet
templateUris: {{ .taskConfig.host }}/{{ .taskConfig.workspace }}/{{ .taskConfig.project_name }}/{{ .taskConfig.experiment_key }}
Copy link
Member

Choose a reason for hiding this comment

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

same thing

Comment on lines 48 to 51
project_name: Optional[str] = None,
workspace: Optional[str] = None,
experiment_key: Optional[str] = None,
secret: Optional[Union[Secret, Callable]] = None,
Copy link
Member

Choose a reason for hiding this comment

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

Can project_name, workspace, and secret be None Optional here in the type hints?
It will be better for the type hints

Copy link
Member Author

Choose a reason for hiding this comment

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

They are already Optional here. Are you suggesting to not make them Optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

I got it to work with 417d03b It forces project_name and friends to be required.

@Future-Outlier
Copy link
Member

@thomasjpfan
Can we add flytekitplugins-comet-ml in the file below?
It will help us run the CI to build the plugin.

https://github.com/flyteorg/flytekit/blob/master/.github/workflows/pythonbuild.yml#L319

@Future-Outlier Future-Outlier merged commit 5a4ba2f into flyteorg:master Jul 17, 2024
92 checks passed
mao3267 pushed a commit to mao3267/flytekit that referenced this pull request Jul 29, 2024
* Adds comet-ml plugin

Signed-off-by: Thomas J. Fan <[email protected]>

* For local execution, do not set experiment_key if it is none

Signed-off-by: Thomas J. Fan <[email protected]>

* Use correct comet-ml links

Signed-off-by: Thomas J. Fan <[email protected]>

* Allow host to be adjustable

Signed-off-by: Thomas J. Fan <[email protected]>

* Adds comet-ml plugin

Signed-off-by: Thomas J. Fan <[email protected]>

* Use new comet-ml login name

Signed-off-by: Thomas J. Fan <[email protected]>

* Require the project_name workspace and secrets

Signed-off-by: Thomas J. Fan <[email protected]>

---------

Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: mao3267 <[email protected]>
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.

3 participants