Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Expetator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
Expetator
Commits
a7a384f7
Commit
a7a384f7
authored
1 month ago
by
Georges Da Costa
Browse files
Options
Downloads
Patches
Plain Diff
removing hosts
parent
ebec14d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
expetator/experiment.py
+12
-3
12 additions, 3 deletions
expetator/experiment.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
13 additions
and
4 deletions
expetator/experiment.py
+
12
−
3
View file @
a7a384f7
...
@@ -10,6 +10,7 @@ import itertools
...
@@ -10,6 +10,7 @@ import itertools
from
pathlib
import
Path
from
pathlib
import
Path
import
tempfile
import
tempfile
import
socket
import
socket
import
psutil
from
functools
import
reduce
from
functools
import
reduce
from
execo
import
Process
from
execo
import
Process
...
@@ -18,7 +19,7 @@ class Executor:
...
@@ -18,7 +19,7 @@ class Executor:
'
Allow access to the platform
'
'
Allow access to the platform
'
def
__init__
(
self
):
def
__init__
(
self
):
self
.
init_mpi_files
()
self
.
init_mpi_files
()
self
.
mpi_options
=
'
--use-hwthread-cpus
'
self
.
mpi_options
=
''
self
.
sudo
=
'
sudo
'
self
.
sudo
=
'
sudo
'
self
.
ssh
=
'
ssh
'
self
.
ssh
=
'
ssh
'
if
'
OAR_NODE_FILE
'
in
os
.
environ
:
if
'
OAR_NODE_FILE
'
in
os
.
environ
:
...
@@ -39,9 +40,10 @@ class Executor:
...
@@ -39,9 +40,10 @@ class Executor:
self
.
tmp_dir
=
tempfile
.
mkdtemp
(
prefix
=
"
/tmp/executor/
"
)
self
.
tmp_dir
=
tempfile
.
mkdtemp
(
prefix
=
"
/tmp/executor/
"
)
self
.
mpi_host_file
=
'
%s/mpi_host_file
'
%
self
.
tmp_dir
self
.
mpi_host_file
=
'
%s/mpi_host_file
'
%
self
.
tmp_dir
self
.
mpi_core_file
=
'
%s/mpi_core_file
'
%
self
.
tmp_dir
self
.
mpi_core_file
=
'
%s/mpi_core_file
'
%
self
.
tmp_dir
nbcore
=
psutil
.
cpu_count
(
logical
=
False
)
if
not
filelist
is
None
:
if
not
filelist
is
None
:
self
.
hostnames
=
filelist
self
.
hostnames
=
filelist
self
.
nbcores
=
os
.
cpu_count
()
*
len
(
filelist
)
self
.
nbcores
=
nbcore
*
len
(
filelist
)
elif
'
OAR_NODE_FILE
'
in
os
.
environ
:
elif
'
OAR_NODE_FILE
'
in
os
.
environ
:
with
open
(
os
.
environ
[
'
OAR_NODE_FILE
'
])
as
filename
:
with
open
(
os
.
environ
[
'
OAR_NODE_FILE
'
])
as
filename
:
content
=
[
host
.
strip
()
for
host
in
filename
.
readlines
()]
content
=
[
host
.
strip
()
for
host
in
filename
.
readlines
()]
...
@@ -50,7 +52,7 @@ class Executor:
...
@@ -50,7 +52,7 @@ class Executor:
self
.
nbcores
=
len
(
content
)
self
.
nbcores
=
len
(
content
)
else
:
else
:
self
.
hostnames
=
[
socket
.
getfqdn
()]
self
.
hostnames
=
[
socket
.
getfqdn
()]
self
.
nbcores
=
os
.
cpu_count
()
self
.
nbcores
=
nbcore
self
.
nbhosts
=
len
(
self
.
hostnames
)
self
.
nbhosts
=
len
(
self
.
hostnames
)
with
open
(
self
.
mpi_host_file
,
'
w
'
)
as
file_id
:
with
open
(
self
.
mpi_host_file
,
'
w
'
)
as
file_id
:
...
@@ -60,6 +62,13 @@ class Executor:
...
@@ -60,6 +62,13 @@ class Executor:
with
open
(
self
.
mpi_core_file
,
'
w
'
)
as
file_id
:
with
open
(
self
.
mpi_core_file
,
'
w
'
)
as
file_id
:
for
host
in
self
.
hostnames
:
for
host
in
self
.
hostnames
:
file_id
.
write
(
host
+
"
slots=%s
\n
"
%
(
self
.
nbcores
//
self
.
nbhosts
))
file_id
.
write
(
host
+
"
slots=%s
\n
"
%
(
self
.
nbcores
//
self
.
nbhosts
))
def
remove_host
(
self
):
if
self
.
nbhosts
==
1
:
return
res
=
self
.
hostnames
.
pop
(
0
)
self
.
init_mpi_files
(
self
.
hostnames
)
return
res
def
local_start
(
self
,
cmd
,
shell
=
True
,
root
=
False
):
def
local_start
(
self
,
cmd
,
shell
=
True
,
root
=
False
):
"""
Executes the cmd command and returns stdout after cmd exits
"""
"""
Executes the cmd command and returns stdout after cmd exits
"""
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
a7a384f7
...
@@ -23,7 +23,7 @@ setuptools.setup(
...
@@ -23,7 +23,7 @@ setuptools.setup(
'
monitors/*.bz2
'
,
'
monitors/*.diff
'
,
'
monitors/*.bz2
'
,
'
monitors/*.diff
'
,
'
leverages/*.[ch]
'
,
'
leverages/*.sh
'
,
'
leverages/*_mak
'
]},
'
leverages/*.[ch]
'
,
'
leverages/*.sh
'
,
'
leverages/*_mak
'
]},
include_package_data
=
True
,
include_package_data
=
True
,
install_requires
=
[
'
execo
'
,
'
requests
'
],
install_requires
=
[
'
execo
'
,
'
requests
'
,
'
psutil
'
],
entry_points
=
{
entry_points
=
{
'
console_scripts
'
:
[
'
console_scripts
'
:
[
'
remove_watermark = expetator.remove_watermark:main
'
,
'
remove_watermark = expetator.remove_watermark:main
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment