Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rechunk-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
ch1187
rechunk-data
Commits
c2877bd6
Commit
c2877bd6
authored
2 years ago
by
Martin Bergemann
Browse files
Options
Downloads
Patches
Plain Diff
Add gitlab ci pipeline
parent
f55fea35
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Tests
Pipeline
#19045
failed
2 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+86
-0
86 additions, 0 deletions
.gitlab-ci.yml
setup.py
+16
-2
16 additions, 2 deletions
setup.py
src/rechunk_data/__init__.py
+9
-5
9 additions, 5 deletions
src/rechunk_data/__init__.py
src/rechunk_data/tests/conftest.py
+4
-1
4 additions, 1 deletion
src/rechunk_data/tests/conftest.py
with
115 additions
and
8 deletions
.gitlab-ci.yml
0 → 100644
+
86
−
0
View file @
c2877bd6
stages
:
-
test
-
report
.template
:
&pyt_test
stage
:
test
tags
:
-
conda
lint
:
<<
:
*py_test
before_script
:
-
pip install .[test]
script
:
-
mypy
-
black --check src
-
pylint src/rechunk_data/__init__.py
test_35
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.5 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
test_36
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.6 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
test_37
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.7 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
test_38
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.8 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
test_39
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.9 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
test_latest
:
<<
:
*py_test
before_script
:
-
conda env create -q -n test python=3.10 pip
-
conda run -n python -m pip install .[test]
script
:
-
pytest -vv
artifacts
:
when
:
always
reports
:
junit
:
report.xml
paths
:
-
coverage_report
-
report.xml
pages
:
stage
:
report
tags
:
-
conda
dependencies
:
-
test_latest
before_script
:
-
mv coverage_report public/
artifacts
:
when
:
always
paths
:
-
public/
reports
:
junit
:
report.xml
This diff is collapsed.
Click to expand it.
setup.py
+
16
−
2
View file @
c2877bd6
...
...
@@ -35,10 +35,24 @@ setup(
packages
=
find_packages
(
"
src
"
),
package_dir
=
{
""
:
"
src
"
},
entry_points
=
{
"
console_scripts
"
:
[
f
"
{
find_key
(
key
=
'
P
rogramName
'
)
}
= rechunk_data:cli
"
]
"
console_scripts
"
:
[
f
"
{
find_key
(
key
=
'
P
ROGRAM_NAME
'
)
}
= rechunk_data:cli
"
]
},
install_requires
=
[
"
argparse
"
,
"
dask
"
,
"
xarray
"
,
"
h5netcdf
"
,
"
netCDF4
"
],
python_requires
=
"
>=3.6
"
,
extras_require
=
{
"
test
"
:
[
"
black
"
,
"
mock
"
,
"
mypy
"
,
"
nbformat
"
,
"
pytest
"
,
"
pytest-html
"
,
"
pytest-env
"
,
"
pytest-cov
"
,
"
testpath
"
,
"
types-mock
"
,
],
},
python_requires
=
"
>=3.5
"
,
classifiers
=
[
"
Development Status :: 3 - Alpha
"
,
"
Environment :: Console
"
,
...
...
This diff is collapsed.
Click to expand it.
src/rechunk_data/__init__.py
+
9
−
5
View file @
c2877bd6
...
...
@@ -11,19 +11,19 @@ from dask.array.core import Array
import
xarray
as
xr
__version__
=
"
2206.0.2
"
P
rogramName
=
"
rechunk-data
"
P
ROGRAM_NAME
=
"
rechunk-data
"
logging
.
basicConfig
(
format
=
"
%(name)s - %(levelname)s - %(message)s
"
,
level
=
logging
.
ERROR
)
logger
=
logging
.
getLogger
(
P
rogramName
)
logger
=
logging
.
getLogger
(
P
ROGRAM_NAME
)
def
parse_args
(
argv
:
Optional
[
List
[
str
]])
->
argparse
.
Namespace
:
"""
Parse arguments for the command line parser.
"""
parser
=
argparse
.
ArgumentParser
(
prog
=
P
rogramName
,
prog
=
P
ROGRAM_NAME
,
description
=
(
"
Rechunk input netcdf data to optimal chunk-size.
"
"
approx. 126 MB per chunk
"
...
...
@@ -57,7 +57,9 @@ def parse_args(argv: Optional[List[str]]) -> argparse.Namespace:
type
=
str
,
)
parser
.
add_argument
(
"
-v
"
,
action
=
"
count
"
,
default
=
0
,
"
-v
"
,
action
=
"
count
"
,
default
=
0
,
)
parser
.
add_argument
(
"
-V
"
,
...
...
@@ -98,7 +100,9 @@ def _save_dataset(
logger
.
debug
(
"
Saving file ot %s
"
,
file_name
)
try
:
dset
.
to_netcdf
(
file_name
,
engine
=
engine
,
encoding
=
encoding
,
file_name
,
engine
=
engine
,
encoding
=
encoding
,
)
except
Exception
as
error
:
logger
.
error
(
"
Saving to file failed: %s
"
,
error
.
__str__
())
...
...
This diff is collapsed.
Click to expand it.
src/rechunk_data/tests/conftest.py
+
4
−
1
View file @
c2877bd6
...
...
@@ -16,7 +16,10 @@ def create_data(
"""
Create a netcdf dataset.
"""
coords
=
{
d
:
np
.
ones
(
chunk_size
[
n
])
for
(
n
,
d
)
in
enumerate
(
dims
)}
dset
=
xr
.
DataArray
(
np
.
zeros
(
chunk_size
),
dims
=
dims
,
coords
=
coords
,
name
=
variable_name
,
np
.
zeros
(
chunk_size
),
dims
=
dims
,
coords
=
coords
,
name
=
variable_name
,
).
chunk
(
dict
(
zip
(
dims
,
chunk_size
)))
dset
.
encoding
=
{
"
chunksizes
"
:
chunk_size
}
return
xr
.
Dataset
({
variable_name
:
dset
})
...
...
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