Skip to content

Commit

Permalink
Merging 3.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeljurf committed Jul 25, 2023
1 parent 0a09ed3 commit 64f2624
Show file tree
Hide file tree
Showing 102 changed files with 1,681 additions and 533 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: pydv-3.1.2
release_name: PyDV 3.1.2
draft: false
tag_name: pydv-3.1.15 release_name: PyDV 3.1.15 draft: false
prerelease: false
154 changes: 154 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
stages:
- create_env
- run_tests
- release
- deploy
- deploy_to_develop

.create_env:
script:
- make create_env

.run_tests:
script:
- make run_tests

.run_rz_tests:
script:
- make run_rz_tests

.release:
script:
- make release

.deploy:
script:
- make deploy

.on_cz:
tags:
- shell
- ruby

.on_rz:
tags:
- shell
- rztopaz

.on_scf:
tags:
- shell
- magma

.run_on_cz:
rules:
- if: '$SOURCE_ZONE == "CZ" && $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ "/^DO NOT CREATE A TAG/"'

.run_on_rz:
rules:
- if: '$SOURCE_ZONE == "RZ" && $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ "/^DO NOT CREATE A TAG/"'

.run_on_scf:
rules:
- if: '$SOURCE_ZONE == "SCF" && $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_TAG == null && $CI_COMMIT_MESSAGE !~ "/^DO NOT CREATE A TAG/"'


.tag_on_cz:
rules:
- if: '$SOURCE_ZONE == "CZ" && $CI_COMMIT_TAG =~ "/^pydv-[0-9]+.[0-9]+.[0-9]+$/"'

.tag_on_rz:
rules:
- if: '$SOURCE_ZONE == "RZ" && $CI_COMMIT_TAG =~ "/^pydv-[0-9]+.[0-9]+.[0-9]+$/"'

.tag_on_scf:
rules:
- if: '$SOURCE_ZONE == "SCF" && $CI_COMMIT_TAG =~ "/^pydv-[0-9]+.[0-9]+.[0-9]+$/"'

.deploy_to_develop_on_cz:
rules:
- if: '$SOURCE_ZONE == "CZ" && $CI_COMMIT_BRANCH == "develop"'

.deploy_to_develop_on_rz:
rules:
- if: '$SOURCE_ZONE == "RZ" && $CI_COMMIT_BRANCH == "develop"'

.deploy_to_develop_on_scf:
rules:
- if: '$SOURCE_ZONE == "SCF" && $CI_COMMIT_BRANCH == "develop"'

create_env_on_cz:
stage: create_env
extends: [ .on_cz, .run_on_cz, .create_env ]

run_tests_on_cz:
stage: run_tests
extends: [ .on_cz, .run_on_cz, .run_tests ]

release_on_cz:
stage: release
extends: [ .on_cz, .tag_on_cz, .release ]

deploy_on_cz:
stage: deploy
variables:
DEPLOY_TO: "prod"
extends: [ .on_cz, .tag_on_cz, .deploy ]

deploy_to_develop_on_cz:
stage: deploy_to_develop
extends: [ .on_cz, .deploy_to_develop_on_cz ]
script:
- make deploy_to_develop

create_env_on_rz:
stage: create_env
extends: [ .on_rz, .run_on_rz, .create_env ]

run_tests_on_rz:
stage: run_tests
extends: [ .on_rz, .run_on_rz, .run_tests ]

run_rz_tests_on_rz:
stage: run_tests
extends: [ .on_rz, .run_on_rz, .run_rz_tests ]

release_on_rz:
stage: release
extends: [ .on_rz, .tag_on_rz, .release ]

deploy_on_rz:
stage: deploy
variables:
DEPLOY_TO: "prod"
extends: [ .on_rz, .tag_on_rz, .deploy ]

deploy_to_develop_on_rz:
stage: deploy_to_develop
extends: [ .on_rz, .deploy_to_develop_on_rz ]
script:
- make deploy_to_develop

create_env_on_scf:
stage: create_env
extends: [ .on_scf, .run_on_scf, .create_env ]

run_tests_on_scf:
stage: run_tests
extends: [ .on_scf, .run_on_scf, .run_tests ]

release_on_scf:
stage: release
extends: [ .on_scf, .tag_on_scf, .release ]

deploy_on_scf:
stage: deploy
variables:
DEPLOY_TO: "prod"
extends: [ .on_scf, .tag_on_scf, .deploy ]

deploy_to_develop_on_scf:
stage: deploy_to_develop
extends: [ .on_scf, .deploy_to_develop_on_scf ]
script:
- make deploy_to_develop
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (c) 2011-2022, Lawrence Livermore National Security, LLC.
Copyright (c) 2011-2023, Lawrence Livermore National Security, LLC.
Produced at the Lawrence Livermore National Laboratory
Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Edward Rusu
e-mail: rusu1@llnl.gov
Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Edward Rusu, Sarah El-Jurf, Jorge Moreno
e-mail: eljurf11@llnl.gov, moreno45@llnl.gov
LLNL-CODE-507071
All rights reserved.

Expand Down
133 changes: 133 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
SHELL := /bin/bash

USER_WORKSPACE := $(if $(USER_WORKSPACE), $(USER_WORKSPACE),/usr/workspace/$(USER))
WORKSPACE = $(USER_WORKSPACE)/gitlab/weave/pydv
PYDV_ENV := $(if $(PYDV_ENV), $(PYDV_ENV),pydv_env)

PKG_REGISTRY_URL = $(CI_API_V4_URL)/projects/$(CI_PROJECT_ID)/packages/generic/archive
DEPLOY_PATH = /usr/gapps/pydv
CI_UTILS = /usr/workspace/weave/ci_utils

RZ_GITLAB = "ssh://git@rzgitlab.llnl.gov:7999"
PROJECT = "weave/pydv.git"

RZ_TESTS_WORKDIR = /usr/gapps/pydv/wsc_tests_workdir
PYTHON_CMD = /usr/tce/bin/python3

define create_env
# call from the directory where env will be created
# arg1: name of env
$(PYTHON_CMD) -m venv $1
source $1/bin/activate &&
pip3 install --upgrade pip &&
pip3 install --force pytest &&
pip3 install numpy scipy matplotlib PySide2 &&
which pytest
endef

define run_pydv_tests
# call from the top repository directory
# arg1: full path to venv
source $1/bin/activate && which pip && which pytest &&
if [ -z $(DISPLAY) ]; then
xvfb-run --auto-servernum pytest --capture=tee-sys -v tests/;
else
pytest --capture=tee-sys -v tests/;
fi
endef

define do_run_rz_tests
cd $(RZ_TESTS_WORKDIR) && rm -rf pydv &&
/usr/tce/bin/git clone -b $(CI_COMMIT_BRANCH) $(RZ_GITLAB)/$(PROJECT) &&
chgrp -R weavedev pydv && cd pydv &&
$(call create_env,$(PYDV_ENV)) &&
cd tests && ln -s /usr/gapps/pydv/dev/tests/wsc_tests . && cd .. &&
$(call run_pydv_tests,$(RZ_TESTS_WORKDIR)/pydv/$(PYDV_ENV)) &&
source $(RZ_TESTS_WORKDIR)/pydv/$(PYDV_ENV)/bin/activate &&
if [ -z $(DISPLAY) ]; then
xvfb-run --auto-servernum python3 -m pytest tests/wsc_tests/test_*py
else
python3 -m pytest -v tests/wsc_tests/test_*py
fi
endef

.PHONY: create_env
create_env:
@echo "Create venv for running pydv...$(WORKSPACE)";
@[ -d $(WORKSPACE) ] || mkdir -p $(WORKSPACE);
cd $(WORKSPACE);
if [ -d $(PYDV_ENV) ]; then \
rm -rf $(PYDV_ENV); \
fi;
$(call create_env,$(PYDV_ENV))


.PHONY: run_tests
run_tests:
@echo "Run tests...";
$(call run_pydv_tests,$(WORKSPACE)/$(PYDV_ENV))


.PHONY: run_rz_tests
.ONESHELL:
run_rz_tests:
@echo "Run RZ tests...RZ_TESTS_WORKDIR: $(RZ_TESTS_WORKDIR)";
xsu weaveci -c "umask 007 && sg weavedev -c '$(call do_run_rz_tests)'"


.PHONY: release
release:
@echo "...create a release....TAG: $(CI_COMMIT_TAG), PKG_REGISTRY_URL: $(PKG_REGISTRY_URL)"; \
$(eval TAG=$(shell echo $(CI_COMMIT_TAG) | sed -e "s/^pydv-//"))
env; \
$(CI_UTILS)/bin/release-cli create --name "PyDV $(CI_COMMIT_TAG)" --tag-name $(CI_COMMIT_TAG); \
tar -cvf $(TAG).tar pydv; \
ls; \
gzip $(TAG).tar; \
curl --header "JOB-TOKEN: $(CI_JOB_TOKEN)" --upload-file $(TAG).tar.gz $(PKG_REGISTRY_URL)/$(CI_COMMIT_TAG)/$(TAG).tar.gz

.PHONY: deploy
.ONESHELL:
deploy:
@echo "...deploy...only run from CI... "; \
$(eval TAG=$(shell echo $(CI_COMMIT_TAG) | sed -e "s/^pydv-//"))
wget --header="JOB-TOKEN:$(CI_JOB_TOKEN)" $(PKG_REGISTRY_URL)/$(CI_COMMIT_TAG)/$(TAG).tar.gz -O $(TAG).tar.gz
give weaveci $(TAG).tar.gz
$(eval GIVE_USER=$(shell echo ${USER}))
xsu weaveci -c "sg us_cit" <<AS_WEAVECI_USER
cd $(DEPLOY_PATH)
take $(GIVE_USER) -f
chmod 750 $(TAG).tar.gz
gunzip $(TAG).tar.gz
tar -xvf $(TAG).tar
rm $(TAG).tar
mv pydv $(TAG)
chmod -R 750 $(TAG)
rm -f current
ln -s $(TAG) current
sed -i 's|python|$(PYTHON_CMD)|' $(TAG)/pdv
AS_WEAVECI_USER


.PHONY: deploy_to_develop
.ONESHELL:
deploy_to_develop:
$(eval VERSION=`cat $(CI_PROJECT_DIR)/pydv/scripts/version.txt`)
echo "...deploy_to_develop...VERSION: $(VERSION)"
cd pydv && if [ -d __pycache__ ]; then rm -rf __pycache__; fi
if [ -f $(VERSION).tar.gz ]; then rm -f $(VERSION).tar.gz; fi
tar -cvf $(VERSION).tar * && gzip $(VERSION).tar
give --force weaveci $(VERSION).tar.gz
$(eval GIVE_USER=$(shell echo ${USER}))
xsu weaveci -c "sg us_cit" <<AS_WEAVECI_USER
umask 027
cd $(DEPLOY_PATH)
if [ ! -d $(DEPLOY_PATH)/develop ]; then mkdir -p $(DEPLOY_PATH)/develop; fi
cd $(DEPLOY_PATH)/develop
take $(GIVE_USER) -f
gunzip $(VERSION).tar.gz
tar -xvf $(VERSION).tar && rm $(VERSION).tar
cd .. && chmod -R 750 develop
sed -i 's|python|$(PYTHON_CMD)|' develop/pdv
AS_WEAVECI_USER

5 changes: 2 additions & 3 deletions pydv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ You can now call most of PyDV's functionality from within a Python script. Below

### Who do I talk to? ###

* Kevin Griffin <griffin28@llnl.gov>
* Doug Miller <miller18@llnl.gov>
* Lee Taylor <taylor16@llnl.gov>
* Sarah El-Jurf <eljurf1@llnl.gov>
* Jorge Moreno <moreno45@llnl.gov>
20 changes: 11 additions & 9 deletions pydv/curve.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2022, Lawrence Livermore National Security, LLC.
# Copyright (c) 2011-2023, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Edward Rusu
# e-mail: rusu1@llnl.gov
Expand Down Expand Up @@ -67,6 +67,10 @@ class Curve(object):

name = ''
filename = ''
record_id = ''
xlabel = ''
ylabel = ''
title = ''
plotname = ''
color = ''
edited = False
Expand All @@ -87,14 +91,15 @@ class Curve(object):
markerfacecolor = None
markeredgecolor = None
plotprecedence = 0
xlabel = ''
ylabel = ''
title = ''
legend_show = True

def __init__(self, filename='', name=''):
def __init__(self, filename='', name='', record_id='', xlabel='', ylabel='', title=''):
self.filename = filename
self.name = name
self.record_id = record_id
self.xlabel = xlabel
self.ylabel = ylabel
self.title = title


def __add__(a, b):
Expand Down Expand Up @@ -187,7 +192,7 @@ def __neg__(a):

##return a new copy of the curve object##
def copy(self):
c = Curve(self.filename, self.name)
c = Curve(self.filename, self.name, self.record_id, self.xlabel, self.ylabel, self.title)
c.plotname = self.plotname
c.x = np.array(self.x)
c.y = np.array(self.y)
Expand All @@ -208,9 +213,6 @@ def copy(self):
c.ebar = self.ebar
c.erange = self.erange
c.plotprecedence = self.plotprecedence
c.xlabel = self.xlabel
c.ylabel = self.ylabel
c.title = self.title

return c

Expand Down
Loading

0 comments on commit 64f2624

Please sign in to comment.