Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
db91e8e6
"testing/python/vscode:/vscode.git/clone" did not exist on "f58bcd43f16ebe6ddd303c400eb1a832e1906ac1"
Unverified
Commit
db91e8e6
authored
Dec 25, 2019
by
SparkSnail
Committed by
GitHub
Dec 25, 2019
Browse files
Support https in paiHost (#1873)
parent
0c7f22fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
7 deletions
+18
-7
src/nni_manager/training_service/pai/paiConfig.ts
src/nni_manager/training_service/pai/paiConfig.ts
+1
-1
src/nni_manager/training_service/pai/paiJobInfoCollector.ts
src/nni_manager/training_service/pai/paiJobInfoCollector.ts
+1
-1
src/nni_manager/training_service/pai/paiK8S/paiK8STrainingService.ts
...ager/training_service/pai/paiK8S/paiK8STrainingService.ts
+2
-1
src/nni_manager/training_service/pai/paiTrainingService.ts
src/nni_manager/training_service/pai/paiTrainingService.ts
+12
-2
src/nni_manager/training_service/pai/paiYarn/paiYarnTrainingService.ts
...er/training_service/pai/paiYarn/paiYarnTrainingService.ts
+2
-2
No files found.
src/nni_manager/training_service/pai/paiConfig.ts
View file @
db91e8e6
...
...
@@ -9,7 +9,7 @@ import { TrialJobApplicationForm, TrialJobDetail, TrialJobStatus } from '../../
export
class
PAIClusterConfig
{
public
readonly
userName
:
string
;
public
readonly
passWord
?:
string
;
public
readonly
host
:
string
;
public
host
:
string
;
public
readonly
token
?:
string
;
/**
...
...
src/nni_manager/training_service/pai/paiJobInfoCollector.ts
View file @
db91e8e6
...
...
@@ -52,7 +52,7 @@ export class PAIJobInfoCollector {
// Rest call to get PAI job info and update status
// Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const
getJobInfoRequest
:
request
.
Options
=
{
uri
:
`
http://
${
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
paiClusterConfig
.
userName
}
/jobs/
${
paiTrialJob
.
paiJobName
}
`
,
uri
:
`
${
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
paiClusterConfig
.
userName
}
/jobs/
${
paiTrialJob
.
paiJobName
}
`
,
method
:
'
GET
'
,
json
:
true
,
headers
:
{
...
...
src/nni_manager/training_service/pai/paiK8S/paiK8STrainingService.ts
View file @
db91e8e6
...
...
@@ -68,6 +68,7 @@ class PAIK8STrainingService extends PAITrainingService {
}
else
if
(
this
.
paiClusterConfig
.
token
)
{
this
.
paiToken
=
this
.
paiClusterConfig
.
token
;
}
this
.
paiClusterConfig
.
host
=
this
.
formatPAIHost
(
this
.
paiClusterConfig
.
host
);
break
;
case
TrialConfigMetadataKey
.
TRIAL_CONFIG
:
...
...
@@ -257,7 +258,7 @@ class PAIK8STrainingService extends PAITrainingService {
// Step 3. Submit PAI job via Rest call
// Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const
submitJobRequest
:
request
.
Options
=
{
uri
:
`
http://
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v2/jobs`
,
uri
:
`
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v2/jobs`
,
method
:
'
POST
'
,
body
:
paiJobConfig
,
headers
:
{
...
...
src/nni_manager/training_service/pai/paiTrainingService.ts
View file @
db91e8e6
...
...
@@ -165,7 +165,7 @@ abstract class PAITrainingService implements TrainingService {
}
const
stopJobRequest
:
request
.
Options
=
{
uri
:
`
http://
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
this
.
paiClusterConfig
.
userName
}
\
uri
:
`
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
this
.
paiClusterConfig
.
userName
}
\
/jobs/
${
trialJobDetail
.
paiJobName
}
/executionType`
,
method
:
'
PUT
'
,
json
:
true
,
...
...
@@ -216,6 +216,16 @@ abstract class PAITrainingService implements TrainingService {
return
this
.
metricsEmitter
;
}
protected
formatPAIHost
(
host
:
string
):
string
{
// If users' host start with 'http://' or 'https://', use the original host,
// or format to 'http//${host}'
if
(
host
.
startsWith
(
'
http://
'
)
||
host
.
startsWith
(
'
https://
'
))
{
return
host
;
}
else
{
return
`http://
${
host
}
`
;
}
}
protected
async
statusCheckingLoop
():
Promise
<
void
>
{
while
(
!
this
.
stopping
)
{
if
(
this
.
paiClusterConfig
&&
this
.
paiClusterConfig
.
passWord
)
{
...
...
@@ -259,7 +269,7 @@ abstract class PAITrainingService implements TrainingService {
}
const
authenticationReq
:
request
.
Options
=
{
uri
:
`
http://
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/token`
,
uri
:
`
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/token`
,
method
:
'
POST
'
,
json
:
true
,
body
:
{
...
...
src/nni_manager/training_service/pai/paiYarn/paiYarnTrainingService.ts
View file @
db91e8e6
...
...
@@ -107,7 +107,7 @@ class PAIYarnTrainingService extends PAITrainingService {
}
else
{
throw
new
Error
(
'
pai cluster config format error, please set password or token!
'
);
}
this
.
paiClusterConfig
.
host
=
this
.
formatPAIHost
(
this
.
paiClusterConfig
.
host
);
break
;
case
TrialConfigMetadataKey
.
TRIAL_CONFIG
:
...
...
@@ -272,7 +272,7 @@ class PAIYarnTrainingService extends PAITrainingService {
// Step 3. Submit PAI job via Rest call
// Refer https://github.com/Microsoft/pai/blob/master/docs/rest-server/API.md for more detail about PAI Rest API
const
submitJobRequest
:
request
.
Options
=
{
uri
:
`
http://
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
this
.
paiClusterConfig
.
userName
}
/jobs`
,
uri
:
`
${
this
.
paiClusterConfig
.
host
}
/rest-server/api/v1/user/
${
this
.
paiClusterConfig
.
userName
}
/jobs`
,
method
:
'
POST
'
,
json
:
true
,
body
:
paiJobConfig
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment