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 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 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