From 0670fd1e3f5d8c84391d278d865097d35e51ff70 Mon Sep 17 00:00:00 2001 From: utkarsh gupta Date: Wed, 26 Jun 2024 15:04:25 +1000 Subject: [PATCH 1/3] added cd to upload to conda --- .github/workflows/CD.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/CD.yml diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000..10f6ca9 --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,37 @@ +name: CD + +on: + push: + branches: + - master + +env: + PY_VERSION: 3.12 + +jobs: + + conda: + name: Build with conda and upload + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Setup conda environment + uses: conda-incubator/setup-miniconda@11b562958363ec5770fef326fe8ef0366f8cbf8a + with: + miniconda-version: "latest" + python-version: ${{ env.PY_VERSION }} + environment-file: conda/environment.yml + auto-update-conda: false + auto-activate-base: false + show-channel-urls: true + + - name: Build and upload the conda package + uses: uibcdf/action-build-and-upload-conda-packages@c6e7a90ad5e599d6cde76e130db4ee52ad733ecf + with: + meta_yaml_dir: conda + python-version: ${{ env.PY_VERSION }} + user: accessnri + label: main + token: ${{ secrets.anaconda_token }} \ No newline at end of file From 67b5da31027941bb3b28ce9dad552f25e1822bee Mon Sep 17 00:00:00 2001 From: utkarsh gupta Date: Wed, 26 Jun 2024 15:49:12 +1000 Subject: [PATCH 2/3] removing coecms and multiple entry of dataset --- conda/environment.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/conda/environment.yml b/conda/environment.yml index c31eb77..b20b7d4 100644 --- a/conda/environment.yml +++ b/conda/environment.yml @@ -1,14 +1,12 @@ name: ncigrafana channels: - - coecms - conda-forge - defaults dependencies: - python - sqlite - - dataset - pandas - matplotlib - numpy From d1d36eaeec240bace51683f7b68b8e66053edcc1 Mon Sep 17 00:00:00 2001 From: utkarsh gupta Date: Fri, 28 Jun 2024 11:01:14 +1000 Subject: [PATCH 3/3] fixing read_sql issue with pandas 2.2.0 --- ncigrafana/UsageDataset.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ncigrafana/UsageDataset.py b/ncigrafana/UsageDataset.py index 0b91a5d..1cdadcf 100755 --- a/ncigrafana/UsageDataset.py +++ b/ncigrafana/UsageDataset.py @@ -421,11 +421,10 @@ def getusage(self, year, quarter, datafield='usage_su', namefield='user+name'): # Pivot makes columns of all the individuals, rows are indexed by date try: - df = pd.read_sql_query(qstring.format(namefield=name_sql, + df = pd.DataFrame(data=list(self.db.query(qstring.format(namefield=name_sql, datafield=datafield, start=startdate, - end=enddate), - self.db.executable).pivot_table(index='Date', + end=enddate)))).pivot_table(index='Date', columns='Name', fill_value=0) except: @@ -470,14 +469,14 @@ def getstorage(self, project, year, quarter, systemname, storagepoint='scratch', # Pivot makes columns of all the individuals, rows are indexed by date try: - df = pd.read_sql_query(qstring.format(namefield=name_sql, + df = pd.DataFrame(data=list(self.db.query(qstring.format(namefield=name_sql, datafield=datafield, table=table, project_id=project_id, storagepoint_id=storagepoint_id, start=startdate, - end=enddate), - self.db.executable).pivot_table(index='Date', columns='Name', fill_value=0) + end=enddate)))).pivot_table(index='Date', + columns='Name', fill_value=0) except: print("No data available for {}".format(storagepoint)) return None