Skip to content

Commit

Permalink
Updated basics algorithm to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvanb committed Oct 17, 2023
1 parent c89ba65 commit ca71692
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 25 deletions.
4 changes: 2 additions & 2 deletions basics/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# basic python3 image as base
FROM harbor.vantage6.ai/algorithms/algorithm-base
FROM harbor2.vantage6.ai/infrastructure/algorithm-base:latest

# This is a placeholder that should be overloaded by invoking
# docker build with '--build-arg PKG_NAME=...'
Expand All @@ -12,4 +12,4 @@ RUN pip install /app
ENV PKG_NAME=${PKG_NAME}

# Tell docker to execute `docker_wrapper()` when the image is run.
CMD python -c "from vantage6.tools.docker_wrapper import docker_wrapper; docker_wrapper('${PKG_NAME}')"
CMD python -c "from vantage6.algorithm.tools.wrap import wrap_algorithm; wrap_algorithm('${PKG_NAME}')"
2 changes: 2 additions & 0 deletions basics/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pandas
vantage6-algorithm-tools
15 changes: 2 additions & 13 deletions basics/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

# # read the API version from disk
# with open(path.join(here, 'vantage6', 'tools', 'VERSION')) as fp:
# __version__ = fp.read()

# setup the package
setup(
name='v6-basics-py',
Expand All @@ -24,14 +20,7 @@
packages=find_packages(),
python_requires='>=3.6',
install_requires=[
# 'vantage6-client'
'pandas',
'vantage6-algorithm-tools',
]
# ,
# extras_require={
# },
# package_data={
# 'vantage6.tools': [
# 'VERSION'
# ],
# }
)
4 changes: 2 additions & 2 deletions basics/v6-basics-py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .column_headers import RPC_column_headers
from .row_count import RPC_row_count
from .column_headers import column_headers
from .row_count import row_count
10 changes: 6 additions & 4 deletions basics/v6-basics-py/column_headers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pandas
import pandas as pd

from vantage6.tools.util import info
from vantage6.algorithm.tools.util import info
from vantage6.algorithm.tools.decorators import data


def RPC_column_headers(data: pandas.DataFrame):
@data(1)
def column_headers(df: pd.DataFrame):
"""
Reports the column headers
Expand All @@ -18,4 +20,4 @@ def RPC_column_headers(data: pandas.DataFrame):
list of strings containing the column headers
"""
info("Reading Headers")
return list(data.columns)
return list(df.columns)
10 changes: 6 additions & 4 deletions basics/v6-basics-py/row_count.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pandas
import pandas as pd

from vantage6.tools.util import info
from vantage6.algorithm.tools.util import info
from vantage6.algorithm.tools.decorators import data


def RPC_row_count(data: pandas.DataFrame):
@data(1)
def row_count(df: pd.DataFrame):
"""
Reports the number of rows in the local dataset
Expand All @@ -18,4 +20,4 @@ def RPC_row_count(data: pandas.DataFrame):
number of rows in the dataset
"""
info("Counting rows")
return len(data.index)
return len(df.index)

0 comments on commit ca71692

Please sign in to comment.