-
Notifications
You must be signed in to change notification settings - Fork 15
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
57 create library for flags for all the different python scripts #63
Changes from 25 commits
fd37bae
81ec55e
b15338f
91a68c9
354d913
710cd3a
1354cab
773f343
e7be8dc
c615d48
62f62f3
b4e25e8
0a87442
3b2dd39
a8c5899
ba240f6
7238553
cb861b8
2f4e36b
3c8046d
d7e1533
2f54f27
a84893d
cfe7e3b
ce38589
acb44dc
df04d18
f8d80e5
39e8e41
45c401b
f3c84a8
3219366
df3d340
fff2b4f
c016690
b8739a1
825faab
a869298
ffcd09b
444db6b
d7ac010
87dd9cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import configparser | ||
import os | ||
import sys | ||
import time | ||
|
||
# Append your local repository path here: | ||
# sys.path.append("/home/sg99/tacc_stats") | ||
|
||
cfg = configparser.ConfigParser() | ||
|
||
# Append your local repository path here: | ||
cfg.read('/home/sg99/tacc_stats/tacc_stats.ini') | ||
|
||
def get_db_connection_string(): | ||
temp_string = "dbname={0} "+cfg.get('PORTAL', 'username')+" "+cfg.get('PORTAL', 'password')+" "+cfg.get('PORTAL', 'port') | ||
connection_string = temp_string.format(cfg.get('PORTAL', 'dbname')) | ||
return connection_string | ||
|
||
def get_db_name(): | ||
db_name = cfg.get('PORTAL', 'dbname') | ||
return db_name | ||
|
||
def get_archive_dir_path(): | ||
archive_dir_path = cfg.get('PORTAL', 'archive_dir') | ||
return archive_dir_path | ||
|
||
def get_host_name_ext(): | ||
host_name_ext = cfg.get('PORTAL', 'host_name_ext') | ||
return host_name_ext | ||
|
||
def get_accounting_path(): | ||
accounting_path = cfg.get('PORTAL', 'acct_path') | ||
return accounting_path | ||
|
||
def get_daily_archive_dir_path(): | ||
daily_archive_dir_path = cfg.get('PORTAL', 'daily_archive_dir') | ||
return daily_archive_dir_path | ||
|
||
def get_rmq_server(): | ||
rmq_server = cfg.get('RMQ', 'rmq_server') | ||
return rmq_server | ||
|
||
def get_rmq_queue(): | ||
rmq_queue = cfg.get('RMQ', 'rmq_queue') | ||
return rmq_queue | ||
|
||
def get_machine_name(): | ||
machine_name = cfg.get('DEFAULT', 'machine') | ||
return machine_name | ||
|
||
def get_server_name(): | ||
server_name = cfg.get('DEFAULT', 'server') | ||
return server_name | ||
|
||
def get_data_dir_path(): | ||
data_dir_path = cfg.get('DEFAULT', 'data_dir') | ||
return data_dir_path | ||
|
||
def get_engine_name(): | ||
engine_name = cfg.get('PORTAL', 'engine_name') | ||
return engine_name | ||
|
||
def get_username(): | ||
username = cfg.get('PORTAL', 'username') | ||
return username | ||
|
||
def get_password(): | ||
password = cfg.get('PORTAL', 'password') | ||
return password | ||
|
||
def get_host(): | ||
host = cfg.get('PORTAL', 'host') | ||
return host | ||
|
||
def get_port(): | ||
port = cfg.get('PORTAL', 'port') | ||
return port | ||
|
||
def get_xalt_engine(): | ||
xalt_engine = cfg.get('XALT', 'xalt_engine') | ||
return xalt_engine | ||
|
||
def get_xalt_name(): | ||
xalt_name = cfg.get('XALT', 'xalt_name') | ||
return xalt_name | ||
|
||
def get_xalt_user(): | ||
xalt_user = cfg.get('XALT', 'xalt_user') | ||
return xalt_user | ||
|
||
def get_xalt_password(): | ||
xalt_password = cfg.get('XALT', 'xalt_password') | ||
return xalt_password | ||
|
||
def get_xalt_host(): | ||
xalt_host = cfg.get('XALT', 'xalt_host') | ||
return xalt_host |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
## Basic configuration options - modify these | ||
# machine = unique name of machine/queue | ||
# server = database and rmq server hostname | ||
# data_dir = where data is stored | ||
[DEFAULT] | ||
machine = stampede2 | ||
machine = tacc-stats-sanga | ||
data_dir = /tacc_stats_site/%(machine)s | ||
server = tacc-stats02.tacc.utexas.edu | ||
server = tacc-stats04.tacc.utexas.edu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this generic in the main tree |
||
|
||
## RabbitMQ Configuration | ||
# RMQ_SERVER = RMQ server | ||
# RMQ_QUEUE = RMQ server | ||
[RMQ] | ||
rmq_server = %(server)s | ||
rmq_queue = %(machine)s | ||
|
||
## Configuration for Web Portal Support | ||
[PORTAL] | ||
acct_path = %(data_dir)s/accounting | ||
archive_dir = %(data_dir)s/archive | ||
host_name_ext = %(machine)s.tacc.utexas.edu | ||
dbname = %(machine)s_db | ||
dbname = test_db | ||
daily_archive_dir = %(data_dir)s/daily_archive | ||
engine_name = django.db.backends.postgresql_psycopg2 | ||
username = taccstats | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change the taccstats user/pass to user and pass |
||
password = taccstats | ||
host = localhost | ||
port = 5432 | ||
|
||
[XALT] | ||
xalt_engine = none | ||
xalt_name = none | ||
xalt_user = none | ||
xalt_password = none | ||
xalt_host = none |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import time | ||
import os,sys,time | ||
# Append your local repository path here: | ||
# sys.path.append("/home/sg99/tacc_stats") | ||
import psycopg2 | ||
import tacc_stats.cfg as cfg | ||
import conf_parser as cfg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conf parser needs to be a full name under taccstats like the line below: from tacc_stats.analysis.gen.utils import read_sql There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a comment for every file |
||
from tacc_stats.analysis.gen.utils import read_sql | ||
|
||
class jid_table: | ||
|
||
def __init__(self, jid): | ||
CONNECTION = "dbname=ls6_db1 host=localhost user=postgres port=5432" | ||
|
||
CONNECTION = cfg.get_db_connection_string() | ||
print("SOMETHING SHOULD PRINT\n") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove debug statements |
||
print(CONNECTION) | ||
print("Initializing table for job {0}".format(jid)) | ||
|
||
self.jid = jid | ||
|
@@ -18,7 +22,7 @@ def __init__(self, jid): | |
# Get job accounting data | ||
acct_data = read_sql("""select * from job_data where jid = '{0}'""".format(jid), self.conj) | ||
# job_data accounting host names must be converted to fqdn | ||
self.acct_host_list = [h + '.' + cfg.host_name_ext for h in acct_data["host_list"].values[0]] | ||
self.acct_host_list = [h + '.' + cfg.get_host_name_ext() for h in acct_data["host_list"].values[0]] | ||
|
||
self.start_time = acct_data["start_time"].dt.tz_convert('US/Central').dt.tz_localize(None).values[0] | ||
self.end_time = acct_data["end_time"].dt.tz_convert('US/Central').dt.tz_localize(None).values[0] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this path non-absolute, we can talk about ways to do this.