Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
fix export yaml bug (#3047)
Browse files Browse the repository at this point in the history
  • Loading branch information
Binyang2014 authored Jul 2, 2019
1 parent 62eb465 commit f3b95be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ import {submitJob} from '../utils/conn';
import MonacoPanel from '../../components/monaco-panel';
import Card from '../../components/card';
import {
getJobComponentsFormConfig,
getJobComponentsFromConfig,
pruneComponents,
populateProtocolWithDataCli,
removePreCommandsFromProtocolTaskRoles,
} from '../utils/utils';
import Context from './context';

import PropTypes from 'prop-types';
import {isNil, debounce, isEqual, isEmpty} from 'lodash';
import {isNil, debounce, isEqual, isEmpty, cloneDeep} from 'lodash';

const JOB_PROTOCOL_SCHEMA_URL =
'https://github.com/microsoft/pai/blob/master/docs/pai-job-protocol.yaml';
Expand Down Expand Up @@ -160,7 +160,7 @@ export const SubmissionSection = (props) => {
updatedTaskRoles,
updatedParameters,
updatedSecrets,
] = getJobComponentsFormConfig(updatedJob);
] = getJobComponentsFromConfig(updatedJob);

pruneComponents(updatedJobInformation, updatedSecrets, {vcNames});
onChange(
Expand All @@ -181,12 +181,12 @@ export const SubmissionSection = (props) => {

const _exportYaml = async (event) => {
event.preventDefault();
const protocol = new JobProtocol(jobProtocol);
const protocol = cloneDeep(jobProtocol);
try {
await populateProtocolWithDataCli(user, protocol, jobData);
_exportFile(
jobProtocol.toYaml(),
(jobInformation.name || 'job') + '.yaml',
protocol.toYaml(),
(protocol.name || 'job') + '.yaml',
'text/yaml',
);
} catch (err) {
Expand Down Expand Up @@ -219,12 +219,12 @@ export const SubmissionSection = (props) => {

const _submitJob = async (event) => {
event.preventDefault();
const protocol = new JobProtocol(jobProtocol);
const protocol = cloneDeep(jobProtocol);
try {
await populateProtocolWithDataCli(user, protocol, jobData);
await submitJob(protocol.toYaml());
window.location.href = `/job-detail.html?username=${user}&jobName=${
jobProtocol.name
protocol.name
}`;
} catch (err) {
alert(err);
Expand Down
4 changes: 2 additions & 2 deletions src/webportal/src/app/job-submission/job-submission.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {SubmissionSection} from './components/submission-section';
import {TaskRoles} from './components/task-roles';
import Context from './components/context';
import {fetchJobConfig, listVirtualClusters} from './utils/conn';
import {getJobComponentsFormConfig} from './utils/utils';
import {getJobComponentsFromConfig} from './utils/utils';
import {TaskRolesManager} from './utils/task-roles-manager';
import {initTheme} from '../components/theme';
import {SpinnerLoading} from '../components/loading';
Expand Down Expand Up @@ -213,7 +213,7 @@ const JobSubmission = () => {
if (user && jobName) {
fetchJobConfig(user, jobName)
.then((jobConfig) => {
const [jobInfo, taskRoles, parameters] = getJobComponentsFormConfig(
const [jobInfo, taskRoles, parameters] = getJobComponentsFromConfig(
jobConfig,
);
setJobTaskRoles(taskRoles);
Expand Down
2 changes: 1 addition & 1 deletion src/webportal/src/app/job-submission/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function pruneComponents(jobInformation, secrets, context) {
}
}

export function getJobComponentsFormConfig(jobConfig) {
export function getJobComponentsFromConfig(jobConfig) {
if (isNil(jobConfig)) {
return;
}
Expand Down

0 comments on commit f3b95be

Please sign in to comment.