Skip to content

Commit

Permalink
Merge pull request #2 from ACCESS-NRI/CD
Browse files Browse the repository at this point in the history
added cd to upload to conda
  • Loading branch information
utkarshgupta95 authored Jul 2, 2024
2 parents c581e28 + d1d36ea commit 5e78942
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 0 additions & 2 deletions conda/environment.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: ncigrafana

channels:
- coecms
- conda-forge
- defaults

dependencies:
- python
- sqlite
- dataset
- pandas
- matplotlib
- numpy
Expand Down
11 changes: 5 additions & 6 deletions ncigrafana/UsageDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e78942

Please sign in to comment.