Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code structure brainstorm #56

Open
teknofire opened this issue Feb 28, 2024 · 0 comments
Open

Code structure brainstorm #56

teknofire opened this issue Feb 28, 2024 · 0 comments

Comments

@teknofire
Copy link
Member

teknofire commented Feb 28, 2024

code deployment

/var/opt/acep-camio/GITHUB_REPO_NAME

How to start the data pipeline download

./data-pipeline --config /etc/acep-kea-events/config.yaml --output ~/data/
`--output` would override the output directory in the config

pseudocode - data-pipeline

configs = parse args['config']
credentials = configs['credentials']
config['meters'].each do |meter|
  ENV['username'] = meter['username'] || credentials['username']
  ENV['password'] = meter['password'] || credentials['password']
  
  exec "meters/#{meter['type']}/download.sh #{meter['ip']} #{output_dir}/#{date}/#{meter_id}"
end

meters/sel735/download.sh

# do something to parse cli flags
meter_ip = $1
output_dir = $2

# connect to the meter
exec ./connect.sh

###
# Call a script to get the new event ids
#  $('./get_events.sh $meter_ip'); should printout a list of event ids seperated by new lines
# example:
# 1234
# 1235
# 1236
# for file in $(ls -l); do echo $file; done
###

for event_id in $(./get_events.sh $meter_ip); do 
  exec ./download_event.sh $meter_ip $event_id $output_dir/$event_id
done

Rambling on how paths/current working directories for scripts

#!/usr/bin/env bash

echo "The script you are running has:"
echo "basename: [$(basename "$0")]"
echo "dirname : [$(dirname "$0")]"
echo "pwd     : [$(pwd)]"

cwd=$(dirname "${0}")

exec $cwd/test.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant