Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
dedal
Commits
1a5d97ca
Commit
1a5d97ca
authored
2 months ago
by
Adrian Ciu
Committed by
adrianciu
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
VT-102: improve spack operation creator
parent
c0a2521f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!10
Dev
Pipeline
#60842
failed with stages
in 34 minutes and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dedal/spack_factory/SpackOperationCreator.py
+12
-1
12 additions, 1 deletion
dedal/spack_factory/SpackOperationCreator.py
dedal/tests/integration_tests/spack_operation_creator_test.py
+14
-0
14 additions, 0 deletions
...l/tests/integration_tests/spack_operation_creator_test.py
with
26 additions
and
1 deletion
dedal/spack_factory/SpackOperationCreator.py
+
12
−
1
View file @
1a5d97ca
import
os
from
dedal.configuration.SpackConfig
import
SpackConfig
from
dedal.configuration.SpackConfig
import
SpackConfig
from
dedal.spack_factory.SpackOperation
import
SpackOperation
from
dedal.spack_factory.SpackOperation
import
SpackOperation
from
dedal.spack_factory.SpackOperationCreateCache
import
SpackOperationCreateCache
from
dedal.spack_factory.SpackOperationCreateCache
import
SpackOperationCreateCache
...
@@ -7,7 +9,16 @@ from dedal.spack_factory.SpackOperationUseCache import SpackOperationUseCache
...
@@ -7,7 +9,16 @@ from dedal.spack_factory.SpackOperationUseCache import SpackOperationUseCache
class
SpackOperationCreator
:
class
SpackOperationCreator
:
@staticmethod
@staticmethod
def
get_spack_operator
(
spack_config
:
SpackConfig
=
None
,
use_cache
:
bool
=
False
)
->
SpackOperation
:
def
get_spack_operator
(
spack_config
:
SpackConfig
=
None
,
use_cache
:
bool
=
False
)
->
SpackOperation
:
if
spack_config
is
None
:
env_vars
=
[
os
.
environ
.
get
(
'
CONCRETIZE_OCI_HOST
'
),
os
.
environ
.
get
(
'
CONCRETIZE_OCI_PROJECT
'
),
os
.
environ
.
get
(
'
CONCRETIZE_OCI_USERNAME
'
),
os
.
environ
.
get
(
'
CONCRETIZE_OCI_PASSWORD
'
),
os
.
environ
.
get
(
'
BUILDCACHE_OCI_HOST
'
),
os
.
environ
.
get
(
'
BUILDCACHE_OCI_PROJECT
'
),
os
.
environ
.
get
(
'
BUILDCACHE_OCI_USERNAME
'
),
os
.
environ
.
get
(
'
BUILDCACHE_OCI_PASSWORD
'
)
]
if
spack_config
is
None
or
None
in
env_vars
:
return
SpackOperation
()
return
SpackOperation
()
elif
spack_config
.
concretization_dir
is
None
and
spack_config
.
buildcache_dir
is
None
:
elif
spack_config
.
concretization_dir
is
None
and
spack_config
.
buildcache_dir
is
None
:
return
SpackOperation
(
spack_config
)
return
SpackOperation
(
spack_config
)
...
...
This diff is collapsed.
Click to expand it.
dedal/tests/integration_tests/spack_operation_creator_test.py
+
14
−
0
View file @
1a5d97ca
import
os
from
dedal.spack_factory.SpackOperationCreateCache
import
SpackOperationCreateCache
from
dedal.spack_factory.SpackOperationCreateCache
import
SpackOperationCreateCache
from
dedal.configuration.SpackConfig
import
SpackConfig
from
dedal.configuration.SpackConfig
import
SpackConfig
...
@@ -29,6 +31,18 @@ def test_spack_creator_scratch_3():
...
@@ -29,6 +31,18 @@ def test_spack_creator_scratch_3():
spack_operation
=
SpackOperationCreator
.
get_spack_operator
(
spack_config
)
spack_operation
=
SpackOperationCreator
.
get_spack_operator
(
spack_config
)
assert
isinstance
(
spack_operation
,
SpackOperation
)
assert
isinstance
(
spack_operation
,
SpackOperation
)
def
test_spack_creator_scratch_4
(
tmp_path
):
concretize_oci_host
=
os
.
environ
.
get
(
'
CONCRETIZE_OCI_HOST
'
)
os
.
environ
.
pop
(
'
CONCRETIZE_OCI_HOST
'
,
None
)
install_dir
=
tmp_path
env
=
SpackDescriptor
(
'
test-spack-env
'
,
install_dir
,
test_spack_env_git
)
repo
=
SpackDescriptor
(
'
ebrains-spack-builds
'
,
install_dir
,
ebrains_spack_builds_git
)
spack_config
=
SpackConfig
(
env
,
install_dir
=
install_dir
,
concretization_dir
=
install_dir
,
buildcache_dir
=
install_dir
)
spack_config
.
add_repo
(
repo
)
spack_operation
=
SpackOperationCreator
.
get_spack_operator
(
spack_config
)
os
.
environ
[
'
CONCRETIZE_OCI_HOST
'
]
=
concretize_oci_host
assert
isinstance
(
spack_operation
,
SpackOperation
)
def
test_spack_creator_create_cache
(
tmp_path
):
def
test_spack_creator_create_cache
(
tmp_path
):
install_dir
=
tmp_path
install_dir
=
tmp_path
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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