Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osc-plugins
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
mpcdf
obs
osc-plugins
Commits
b5d2f9b5
"vaspparser/parser_vasprun.py" did not exist on "ab86b6be113a8af3905357dd22a0c4744edebfd3"
Commit
b5d2f9b5
authored
6 years ago
by
Lorenz Huedepohl
Browse files
Options
Downloads
Patches
Plain Diff
Better error handling for unset attributes
parent
425612a5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mpcdf_common.py
+19
-26
19 additions, 26 deletions
mpcdf_common.py
with
19 additions
and
26 deletions
mpcdf_common.py
+
19
−
26
View file @
b5d2f9b5
...
...
@@ -150,28 +150,28 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False):
for
enable
in
build
.
findall
(
"
./enable
"
):
build
.
remove
(
enable
)
compilers
=
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:compiler_modules
"
,
with_project
=
True
)
all_compilers
=
get_attribute_values
(
api_url
,
project
,
None
,
"
MPCDF:compiler_modules
"
)
mpis
=
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:mpi_modules
"
,
with_project
=
True
)
cudas
=
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:cuda_modules
"
,
with_project
=
True
)
try
:
default_compilers
=
get_attribute_values
(
api_url
,
project
,
None
,
"
MPCDF:default_compiler
"
)
except
UnsetAttributeException
:
print
(
"
ERROR: Attribute MPCDF:default_compiler not set for project
"
,
file
=
sys
.
stderr
)
raise
SystemExit
(
1
)
enable_repos
=
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:enable_repositories
"
)
except
Exception
:
if
verbose
:
print
(
"
Warning: Could not get attribute MPCDF:enable_repositories for package {0}, skipping
"
.
format
(
package
))
return
False
try
:
default_mpis
=
get_attribute_values
(
api_url
,
project
,
None
,
"
MPCDF:default_mpi
"
)
except
UnsetAttributeException
:
print
(
"
ERROR: Attribute MPCDF:default_mpi not set for project
"
,
file
=
sys
.
stderr
)
raise
SystemExit
(
1
)
def
try_get_attribute
(
attribute
,
package
,
with_project
=
False
):
try
:
return
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:
"
+
attribute
,
with_project
=
with_project
)
except
UnsetAttributeException
:
print
(
"
ERROR: Attribute MPCDF:
"
+
attribute
+
"
is not set, aborting here
"
,
file
=
sys
.
stderr
)
raise
SystemExit
(
1
)
try
:
default_cudas
=
get_attribute_values
(
api_url
,
project
,
None
,
"
MPCDF:default_cuda
"
)
except
UnsetAttributeException
:
print
(
"
ERROR: Attribute MPCDF:default_cuda not set for project
"
,
file
=
sys
.
stderr
)
raise
SystemExit
(
1
)
compilers
=
try_get_attribute
(
package
,
"
compiler_modules
"
,
with_project
=
True
)
all_compilers
=
try_get_attribute
(
None
,
"
compiler_modules
"
)
mpis
=
try_get_attribute
(
package
,
"
mpi_modules
"
,
with_project
=
True
)
cudas
=
try_get_attribute
(
package
,
"
cuda_modules
"
,
with_project
=
True
)
default_compilers
=
try_get_attribute
(
None
,
"
default_compiler
"
)
default_mpis
=
try_get_attribute
(
None
,
"
default_mpi
"
)
default_cudas
=
try_get_attribute
(
None
,
"
default_cuda
"
)
def
enable
(
name
):
node
=
ElementTree
.
Element
(
"
enable
"
)
...
...
@@ -181,13 +181,6 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False):
if
verbose
:
print
(
"
Enabling
"
,
name
)
try
:
enable_repos
=
get_attribute_values
(
api_url
,
project
,
package
,
"
MPCDF:enable_repositories
"
)
except
Exception
:
if
verbose
:
print
(
"
Warning: Could not get attribute MPCDF:enable_repositories for package {0}
"
.
format
(
package
))
return
False
def
actual_compilers
():
for
compiler
in
compilers
:
if
compiler
==
"
intel
"
:
...
...
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