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

SUBMARINE-1236. Fix patch strategy #915

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ public Experiment patchExperiment(ExperimentSpec spec) throws SubmarineRuntimeEx
mlJob.getMetadata().setNamespace(getServerNamespace());
Object object = mlJob.getPlural().equals(TFJob.CRD_TF_PLURAL_V1)
? tfJobClient.patch(getServerNamespace(), mlJob.getMetadata().getName(),
V1Patch.PATCH_FORMAT_JSON_PATCH,
V1Patch.PATCH_FORMAT_APPLY_YAML,
new V1Patch(new Gson().toJson(((TFJob) mlJob).getSpec()))).throwsApiException().getObject()
: pyTorchJobClient.patch(getServerNamespace(), mlJob.getMetadata().getName(),
V1Patch.PATCH_FORMAT_JSON_PATCH,
V1Patch.PATCH_FORMAT_APPLY_YAML,
new V1Patch(new Gson().toJson(((PyTorchJob) mlJob).getSpec()))).throwsApiException().getObject()
;
experiment = parseExperimentResponseObject(object, ParseOp.PARSE_OP_RESULT);
Expand All @@ -341,20 +341,20 @@ public Experiment deleteExperiment(ExperimentSpec spec) throws SubmarineRuntimeE
try {
MLJob mlJob = ExperimentSpecParser.parseJob(spec);
mlJob.getMetadata().setNamespace(getServerNamespace());

AgentPod agentPod = new AgentPod(getServerNamespace(), spec.getMeta().getName(),
mlJob.getPlural().equals(TFJob.CRD_TF_PLURAL_V1)
? CustomResourceType.TFJob : CustomResourceType.PyTorchJob,
spec.getMeta().getExperimentId());

Object object = mlJob.getPlural().equals(TFJob.CRD_TF_PLURAL_V1)
? tfJobClient.delete(getServerNamespace(), mlJob.getMetadata().getName(),
MLJobConverter.toDeleteOptionsFromMLJob(mlJob))
.throwsApiException().getStatus()
: pyTorchJobClient.delete(getServerNamespace(), mlJob.getMetadata().getName(),
MLJobConverter.toDeleteOptionsFromMLJob(mlJob))
.throwsApiException().getStatus();

LOG.info(String.format("Experiment:%s had been deleted, start to delete agent pod:%s",
spec.getMeta().getName(), agentPod.getMetadata().getName()));
podClient.delete(agentPod.getMetadata().getNamespace(), agentPod.getMetadata().getName());
Expand Down