-
Notifications
You must be signed in to change notification settings - Fork 45
feat(optimizer): Add get_job_logs API to OptimizerClient #148
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
Conversation
Signed-off-by: kramaranya <[email protected]>
Pull Request Test Coverage Report for Build 19122484801Details
💛 - Coveralls |
| def get_job_logs( | ||
| self, | ||
| name: str, | ||
| trial: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use trial_name here ?
| trial: Optional[str] = None, | |
| trial_name: Optional[str] = None, |
kubeflow/optimizer/backends/base.py
Outdated
| def get_job_logs( | ||
| self, | ||
| name: str, | ||
| trial: Optional[str], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| trial: Optional[str], | |
| trial_name: Optional[str], |
| if trial is None: | ||
| # Get logs from the best current trial. | ||
| best_trial = self.get_best_trial(name) | ||
| if best_trial is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed, if the best Trial is empty, let's take the first Trial from the OptimizationJob if list is not empty:
| trials: list[Trial] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, updated in 66927dc
| # TODO (kramaranya): Consider waiting for best trial when follow=True | ||
| return | ||
| trial = best_trial.name | ||
| logger.info(f"Getting logs from best trial: {trial}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use .debug here, since we don't use .info logging in the SDK for now.
| logger.info(f"Getting logs from best trial: {trial}") | |
| logger.debug(f"Getting logs from best trial: {trial}") |
| name: str, | ||
| trial: Optional[str] = None, | ||
| follow: bool = False, | ||
| step: str = trainer_constants.NODE + "-0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for now, we should remove step from this API ?
The problem is that for other Steps (e.g. Pods), the container name is not metrics-logger-and-collector.
As a workaround, users can always use TrainerClient() to get logs for other steps of TrainJob
(e.g. TrainJob name == Trial name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this too, makes sense to me, updated in e1a00b8
| return | ||
|
|
||
| container_name = constants.METRICS_COLLECTOR_CONTAINER | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce code duplication can you wrap this code under helper function: self.__read_pod_logs(pod_name: str, container_name: str, follow: bool) in , the Trainer client and use it as:
yield from self.trainer_backend.__read_pod_logs(
pod_name=pod_name,
container_name=container_name,
follow=follow
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 49b4da0
Signed-off-by: kramaranya <[email protected]>
Signed-off-by: kramaranya <[email protected]>
Signed-off-by: kramaranya <[email protected]>
andreyvelich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kramaranya!
/lgtm
/assign @Electronic-Waste @astefanutti
|
Thanks @kramaranya /lgtm I think we need to improve how Katib instruments the train nodes for StdOutCollector and FileCollector metrics to avoid depending on the metric collector sidecar and also make it work for other configurations like TfEventCollector or PrometheusMetricCollector. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: astefanutti The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I've added
get_job_logsAPI to the OptimizerClientWorking example:
/assign @kubeflow/kubeflow-sdk-team