Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ess-python-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
ESS Beam Physics
ess-python-tools
Commits
9cbbbb0b
Commit
9cbbbb0b
authored
5 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
fixing tracewin_errorstudy script for python3
parent
648a2e68
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
ess/__queue_templates__.py
+2
-2
2 additions, 2 deletions
ess/__queue_templates__.py
scripts/tracewin_errorstudy
+20
-19
20 additions, 19 deletions
scripts/tracewin_errorstudy
with
22 additions
and
21 deletions
ess/__queue_templates__.py
+
2
−
2
View file @
9cbbbb0b
...
@@ -8,7 +8,7 @@ initialdir = {args.calc_dir}/Local_TraceWin_$(Process)
...
@@ -8,7 +8,7 @@ initialdir = {args.calc_dir}/Local_TraceWin_$(Process)
transfer_input_files = {input_files}
transfer_input_files = {input_files}
requirements = ( OpSys ==
"
LINUX
"
|| OpSys ==
"
OSX
"
)
requirements = ( OpSys ==
"
LINUX
"
|| OpSys ==
"
OSX
"
)
log = condor.log
log = condor.log
executable = TraceWin
_
exe/tracewin.$$(OpSys).$$(Arch)
executable = TraceWin
/
exe/tracewin.$$(OpSys).$$(Arch)
"""
"""
HEAD_MULTI_TEMPLATE
=
"""
HEAD_MULTI_TEMPLATE
=
"""
universe = Vanilla
universe = Vanilla
...
@@ -16,7 +16,7 @@ universe = Vanilla
...
@@ -16,7 +16,7 @@ universe = Vanilla
should_transfer_files = yes
should_transfer_files = yes
requirements = ( OpSys ==
"
LINUX
"
|| OpSys ==
"
OSX
"
)
requirements = ( OpSys ==
"
LINUX
"
|| OpSys ==
"
OSX
"
)
log = condor.log
log = condor.log
executable = TraceWin
_
exe/tracewin.$$(OpSys).$$(Arch)
executable = TraceWin
/
exe/tracewin.$$(OpSys).$$(Arch)
"""
"""
QUEUE_TEMPLATE
=
"""
QUEUE_TEMPLATE
=
"""
...
...
This diff is collapsed.
Click to expand it.
scripts/tracewin_errorstudy
+
20
−
19
View file @
9cbbbb0b
...
@@ -20,10 +20,10 @@ def define_and_handle_args():
...
@@ -20,10 +20,10 @@ def define_and_handle_args():
def
setup_exec_folder
():
def
setup_exec_folder
():
import
os
,
shutil
import
os
,
shutil
orig_path
=
os
.
path
.
join
(
os
.
environ
.
get
(
"
HOME
"
),
"
TraceWin
_
exe
"
)
orig_path
=
os
.
path
.
join
(
os
.
environ
.
get
(
"
HOME
"
),
"
TraceWin
/
exe
"
)
if
not
os
.
path
.
isdir
(
orig_path
):
if
not
os
.
path
.
isdir
(
orig_path
):
raise
ValueError
(
"
Cannot find tracewin executables in
"
+
orig_path
+
"
yet
"
)
raise
ValueError
(
"
Cannot find tracewin executables in
"
+
orig_path
+
"
yet
"
)
os
.
makedirs
(
"
TraceWin
_
exe
"
)
os
.
makedirs
(
"
TraceWin
/
exe
"
)
o
=
dict
(
LINUX
=
"
lx
"
,
OSX
=
"
mac
"
)
o
=
dict
(
LINUX
=
"
lx
"
,
OSX
=
"
mac
"
)
a
=
dict
(
INTEL
=
""
,
X86_64
=
"
64
"
)
a
=
dict
(
INTEL
=
""
,
X86_64
=
"
64
"
)
...
@@ -31,7 +31,7 @@ def setup_exec_folder():
...
@@ -31,7 +31,7 @@ def setup_exec_folder():
for
OpSys
in
[
"
LINUX
"
,
"
OSX
"
]:
for
OpSys
in
[
"
LINUX
"
,
"
OSX
"
]:
for
Arch
in
[
"
INTEL
"
,
"
X86_64
"
]:
for
Arch
in
[
"
INTEL
"
,
"
X86_64
"
]:
shutil
.
copy
(
os
.
path
.
join
(
orig_path
,
"
trace
"
+
o
[
OpSys
]
+
a
[
Arch
]),
shutil
.
copy
(
os
.
path
.
join
(
orig_path
,
"
trace
"
+
o
[
OpSys
]
+
a
[
Arch
]),
os
.
path
.
join
(
"
TraceWin
_
exe
"
,
"
tracewin.%s.%s
"
%
(
OpSys
,
Arch
)))
os
.
path
.
join
(
"
TraceWin
/
exe
"
,
"
tracewin.%s.%s
"
%
(
OpSys
,
Arch
)))
def
create_and_copy_lattice
(
args
,
calc_dir
,
commented
=
[],
extra_line
=
''
):
def
create_and_copy_lattice
(
args
,
calc_dir
,
commented
=
[],
extra_line
=
''
):
'''
'''
...
@@ -45,20 +45,21 @@ def create_and_copy_lattice(args, calc_dir, commented=[], extra_line=''):
...
@@ -45,20 +45,21 @@ def create_and_copy_lattice(args, calc_dir, commented=[], extra_line=''):
if
os
.
path
.
exists
(
args
.
settings
):
if
os
.
path
.
exists
(
args
.
settings
):
# Create the lattice file from template:
# Create the lattice file from template:
lattice_settings
=
yaml
.
load
(
file
(
args
.
settings
,
'
r
'
).
read
())
lattice_settings
=
yaml
.
load
(
open
(
args
.
settings
,
'
r
'
).
read
())
lattice_settings
[
'
extra_line
'
]
=
extra_line
lattice_settings
[
'
extra_line
'
]
=
extra_line
lattice_template
=
file
(
args
.
lattice
+
'
.tmp
'
,
'
r
'
).
read
()
lattice_template
=
open
(
args
.
lattice
+
'
.tmp
'
,
'
r
'
).
read
()
for
cmd
in
commented
:
for
cmd
in
commented
:
lattice_template
=
lattice_template
.
replace
(
cmd
.
lower
(),
'
;
'
+
cmd
)
lattice_template
=
lattice_template
.
replace
(
cmd
.
lower
(),
'
;
'
+
cmd
)
lattice_template
=
lattice_template
.
replace
(
cmd
.
upper
(),
'
;
'
+
cmd
)
lattice_template
=
lattice_template
.
replace
(
cmd
.
upper
(),
'
;
'
+
cmd
)
file
(
os
.
path
.
join
(
calc_dir
,
args
.
lattice
),
'
w
'
).
write
(
lattice_template
.
format
(
**
lattice_settings
))
open
(
os
.
path
.
join
(
calc_dir
,
args
.
lattice
),
'
w
'
).
write
(
lattice_template
.
format
(
**
lattice_settings
))
shutil
.
copy
(
args
.
settings
,
calc_dir
)
shutil
.
copy
(
args
.
settings
,
calc_dir
)
else
:
else
:
shutil
.
copy
(
args
.
lattice
,
os
.
path
.
join
(
calc_dir
,
args
.
lattice
))
if
calc_dir
!=
'
.
'
:
shutil
.
copy
(
args
.
lattice
,
os
.
path
.
join
(
calc_dir
,
args
.
lattice
))
for
folder
in
os
.
listdir
(
calc_dir
):
for
folder
in
os
.
listdir
(
calc_dir
):
if
folder
[
0
:
15
]
==
"
Local_TraceWin_
"
:
if
folder
[
0
:
15
]
==
"
Local_TraceWin_
"
:
...
@@ -113,10 +114,10 @@ def setup_multi(args):
...
@@ -113,10 +114,10 @@ def setup_multi(args):
num_jobs
=
0
num_jobs
=
0
new_folders
=
[]
new_folders
=
[]
for
njob
in
x
range
(
args
.
num_jobs
):
for
njob
in
range
(
args
.
num_jobs
):
folder
=
'
Local_TraceWin_{}
'
.
format
(
njob
)
folder
=
'
Local_TraceWin_{}
'
.
format
(
njob
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
calc_dir
,
folder
,
'
Error_Datas.txt
'
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
args
.
calc_dir
,
folder
,
'
Error_Datas.txt
'
)):
for
mjob
in
x
range
(
args
.
multi
):
for
mjob
in
range
(
args
.
multi
):
num_jobs
+=
1
num_jobs
+=
1
if
mjob
==
int
(
folder
.
split
(
'
_
'
)[
-
1
]):
if
mjob
==
int
(
folder
.
split
(
'
_
'
)[
-
1
]):
continue
continue
...
@@ -126,19 +127,19 @@ def setup_multi(args):
...
@@ -126,19 +127,19 @@ def setup_multi(args):
delete_output_files
(
args
,
newfolder
)
delete_output_files
(
args
,
newfolder
)
create_and_copy_lattice
(
args
,
os
.
path
.
join
(
args
.
calc_dir
,
newfolder
),
commented
=
[
'
ERROR_CAV_CPL_DYN
'
,
'
ERROR_CAV_NCPL_DYN
'
],
extra_line
=
'
ERROR_DYN_FILE Error_Datas.txt
'
)
create_and_copy_lattice
(
args
,
os
.
path
.
join
(
args
.
calc_dir
,
newfolder
),
commented
=
[
'
ERROR_CAV_CPL_DYN
'
,
'
ERROR_CAV_NCPL_DYN
'
],
extra_line
=
'
ERROR_DYN_FILE Error_Datas.txt
'
)
if
not
os
.
path
.
isdir
(
"
TraceWin
_
exe
"
):
if
not
os
.
path
.
isdir
(
"
TraceWin
/
exe
"
):
setup_exec_folder
()
setup_exec_folder
()
# Get random seeds from previously run jobs:
# Get random seeds from previously run jobs:
seeds
=
[]
seeds
=
[]
for
l
in
file
(
os
.
path
.
join
(
args
.
calc_dir
,
'
submit.job
'
)):
for
l
in
open
(
os
.
path
.
join
(
args
.
calc_dir
,
'
submit.job
'
)
,
'
r
'
):
if
len
(
l
.
strip
())
and
l
.
split
()[
0
]
==
'
arguments
'
:
if
len
(
l
.
strip
())
and
l
.
split
()[
0
]
==
'
arguments
'
:
seeds
.
append
(
l
.
split
()[
-
1
])
seeds
.
append
(
l
.
split
()[
-
1
])
head_template
=
__queue_templates__
.
get_head_multi_template
()
head_template
=
__queue_templates__
.
get_head_multi_template
()
queue_template
=
__queue_templates__
.
get_queue_multi_template
()
queue_template
=
__queue_templates__
.
get_queue_multi_template
()
with
file
(
args
.
calc_dir
+
"
/multi.job
"
,
"
w
"
)
as
out
:
with
open
(
args
.
calc_dir
+
"
/multi.job
"
,
"
w
"
)
as
out
:
out
.
write
(
head_template
.
format
(
**
locals
()))
out
.
write
(
head_template
.
format
(
**
locals
()))
for
job_folder
in
new_folders
:
for
job_folder
in
new_folders
:
...
@@ -176,7 +177,7 @@ def setup(args):
...
@@ -176,7 +177,7 @@ def setup(args):
# Create extra folders if needed..
# Create extra folders if needed..
if
args
.
num_jobs
>
num_jobs
:
if
args
.
num_jobs
>
num_jobs
:
for
n
in
x
range
(
num_jobs
,
args
.
num_jobs
):
for
n
in
range
(
num_jobs
,
args
.
num_jobs
):
folder_name
=
'
Local_TraceWin_{n}
'
.
format
(
**
locals
())
folder_name
=
'
Local_TraceWin_{n}
'
.
format
(
**
locals
())
create_extra_folder
(
args
.
calc_dir
,
'
Local_TraceWin_0
'
,
folder_name
)
create_extra_folder
(
args
.
calc_dir
,
'
Local_TraceWin_0
'
,
folder_name
)
num_jobs
=
args
.
num_jobs
num_jobs
=
args
.
num_jobs
...
@@ -186,12 +187,12 @@ def setup(args):
...
@@ -186,12 +187,12 @@ def setup(args):
create_and_copy_lattice
(
args
,
args
.
calc_dir
)
create_and_copy_lattice
(
args
,
args
.
calc_dir
)
if
not
os
.
path
.
isdir
(
"
TraceWin
_
exe
"
):
if
not
os
.
path
.
isdir
(
"
TraceWin
/
exe
"
):
setup_exec_folder
()
setup_exec_folder
()
if
args
.
seed
!=
None
:
if
args
.
seed
!=
None
:
random
.
seed
(
args
.
seed
)
random
.
seed
(
args
.
seed
)
rand_lst
=
[
random
.
randint
(
1e5
,
1e9
)
for
i
in
x
range
(
num_jobs
)]
rand_lst
=
[
random
.
randint
(
1e5
,
1e9
)
for
i
in
range
(
num_jobs
)]
#rand_lst=file('rand.dat','r').read().split()
#rand_lst=file('rand.dat','r').read().split()
# Get file list:
# Get file list:
...
@@ -203,10 +204,10 @@ def setup(args):
...
@@ -203,10 +204,10 @@ def setup(args):
head_template
=
__queue_templates__
.
get_head_template
()
head_template
=
__queue_templates__
.
get_head_template
()
queue_template
=
__queue_templates__
.
get_queue_template
()
queue_template
=
__queue_templates__
.
get_queue_template
()
with
file
(
args
.
calc_dir
+
"
/submit.job
"
,
"
w
"
)
as
out
:
with
open
(
args
.
calc_dir
+
"
/submit.job
"
,
"
w
"
)
as
out
:
out
.
write
(
head_template
.
format
(
**
locals
()))
out
.
write
(
head_template
.
format
(
**
locals
()))
for
i
in
x
range
(
num_jobs
):
for
i
in
range
(
num_jobs
):
q_priority
=
max
(
-
5
,
args
.
priority
-
i
/
100
)
q_priority
=
max
(
-
5
,
args
.
priority
-
i
/
100
)
rand
=
rand_lst
[
i
]
rand
=
rand_lst
[
i
]
out
.
write
(
queue_template
.
format
(
**
locals
()))
out
.
write
(
queue_template
.
format
(
**
locals
()))
...
@@ -215,7 +216,7 @@ def ask(args):
...
@@ -215,7 +216,7 @@ def ask(args):
print
(
"
You have now set up an error study running {} jobs in folder {}
"
.
format
(
args
.
num_jobs
,
args
.
calc_dir
))
print
(
"
You have now set up an error study running {} jobs in folder {}
"
.
format
(
args
.
num_jobs
,
args
.
calc_dir
))
if
args
.
multi
>
1
:
if
args
.
multi
>
1
:
print
(
"
This is a multi-error study
"
)
print
(
"
This is a multi-error study
"
)
answer
=
raw_
input
(
"
Do you want to submit the jobs immediately? (yes/no)
"
)
answer
=
input
(
"
Do you want to submit the jobs immediately? (yes/no)
"
)
if
answer
==
'
yes
'
:
if
answer
==
'
yes
'
:
return
0
return
0
...
...
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