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
638da0bd
Unverified
Commit
638da0bd
authored
Apr 21, 2021
by
J-shang
Committed by
GitHub
Apr 21, 2021
Browse files
cherry pick from PR3455 (#3528)
parent
4a0cc125
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
1 deletion
+23
-1
ts/nni_manager/training_service/remote_machine/extends/linuxCommands.ts
.../training_service/remote_machine/extends/linuxCommands.ts
+4
-0
ts/nni_manager/training_service/remote_machine/extends/windowsCommands.ts
...raining_service/remote_machine/extends/windowsCommands.ts
+4
-0
ts/nni_manager/training_service/remote_machine/osCommands.ts
ts/nni_manager/training_service/remote_machine/osCommands.ts
+1
-0
ts/nni_manager/training_service/remote_machine/shellExecutor.ts
..._manager/training_service/remote_machine/shellExecutor.ts
+10
-0
ts/nni_manager/training_service/reusable/environments/remoteEnvironmentService.ts
...service/reusable/environments/remoteEnvironmentService.ts
+4
-1
No files found.
ts/nni_manager/training_service/remote_machine/extends/linuxCommands.ts
View file @
638da0bd
...
...
@@ -146,6 +146,10 @@ class LinuxCommands extends OsCommands {
public
fileExistCommand
(
filePath
:
string
):
string
{
return
`test -e
${
filePath
}
&& echo True || echo False`
;
}
public
getCurrentPath
():
string
{
return
`pwd`
;
}
}
export
{
LinuxCommands
};
ts/nni_manager/training_service/remote_machine/extends/windowsCommands.ts
View file @
638da0bd
...
...
@@ -134,6 +134,10 @@ class WindowsCommands extends OsCommands {
public
fileExistCommand
(
filePath
:
string
):
string
{
return
`powershell Test-Path
${
filePath
}
-PathType Leaf`
;
}
public
getCurrentPath
():
string
{
return
`chdir`
;
}
}
export
{
WindowsCommands
};
ts/nni_manager/training_service/remote_machine/osCommands.ts
View file @
638da0bd
...
...
@@ -30,6 +30,7 @@ abstract class OsCommands {
public
abstract
executeScript
(
script
:
string
,
isFile
:
boolean
):
string
;
public
abstract
setPythonPath
(
pythonPath
:
string
|
undefined
,
command
:
string
|
undefined
):
string
|
undefined
;
public
abstract
fileExistCommand
(
filePath
:
string
):
string
|
undefined
;
public
abstract
getCurrentPath
():
string
;
public
joinPath
(...
paths
:
string
[]):
string
{
let
dir
:
string
=
paths
.
filter
((
path
:
any
)
=>
path
!==
''
).
join
(
this
.
pathSpliter
);
...
...
ts/nni_manager/training_service/remote_machine/shellExecutor.ts
View file @
638da0bd
...
...
@@ -169,6 +169,16 @@ class ShellExecutor {
return
this
.
tempPath
;
}
public
async
getCurrentPath
():
Promise
<
string
>
{
const
commandText
=
this
.
osCommands
&&
this
.
osCommands
.
getCurrentPath
();
const
commandResult
=
await
this
.
execute
(
commandText
);
if
(
commandResult
.
exitCode
==
0
)
{
return
commandResult
.
stdout
;
}
else
{
throw
Error
(
commandResult
.
stderr
);
}
}
public
getRemoteScriptsPath
(
experimentId
:
string
):
string
{
return
this
.
joinPath
(
this
.
getRemoteExperimentRootDir
(
experimentId
),
'
scripts
'
);
}
...
...
ts/nni_manager/training_service/reusable/environments/remoteEnvironmentService.ts
View file @
638da0bd
...
...
@@ -236,7 +236,10 @@ export class RemoteEnvironmentService extends EnvironmentService {
const
executor
=
await
this
.
getExecutor
(
environment
.
id
);
if
(
environment
.
useSharedStorage
)
{
this
.
remoteExperimentRootDir
=
component
.
get
<
SharedStorageService
>
(
SharedStorageService
).
remoteWorkingRoot
;
const
remoteMountCommand
=
component
.
get
<
SharedStorageService
>
(
SharedStorageService
).
remoteMountCommand
.
replace
(
/echo -e /g
,
`echo `
).
replace
(
/echo /g
,
`echo -e `
);
if
(
!
this
.
remoteExperimentRootDir
.
startsWith
(
'
/
'
))
{
this
.
remoteExperimentRootDir
=
executor
.
joinPath
((
await
executor
.
getCurrentPath
()).
trim
(),
this
.
remoteExperimentRootDir
);
}
const
remoteMountCommand
=
component
.
get
<
SharedStorageService
>
(
SharedStorageService
).
remoteMountCommand
.
replace
(
/echo -e /g
,
`echo `
).
replace
(
/echo /g
,
`echo -e `
).
replace
(
/
\\\$
/g
,
`\\\\\
\$
`
);
const
result
=
await
executor
.
executeScript
(
remoteMountCommand
,
false
,
false
);
if
(
result
.
exitCode
!==
0
)
{
throw
new
Error
(
`Mount shared storage on remote machine failed.\n ERROR:
${
result
.
stderr
}
`
);
...
...
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