import solar import log import sscapi from utils import timeit from utils import _create_data_folder, get_solar_data from utils import check_nsrdb from nsrdb import get_nsrdb_data from context import * ROOT = Path(__file__).parents[1] # Module level variables DATA_DIR = ROOT / 'data' DATA_DIR.mkdir(exist_ok=True, parents=True) logger = log.custom_logger(__name__) @click.command() @click.option('--lat', default=19.5, prompt='Latitude', help='Latitude of the place') @click.option('--lng', default=-99.5, prompt='Longitude', help='Longitude of the place') @click.option('--year', default=2014, prompt='Year', help='Year of data up to 2016')
#!/usr/bin/env python import os import sys import time import igraph import logging import operator from action import Action import log logger = log.custom_logger("Test print") class Test_print(Action): def run(self, *arg, **args): for idx in range(1, self.args["cycle"]): logger.debug("SEQ: %s PID: %s" % (idx, os.getpid())) print "ARGS: ", args print "ARG", arg time.sleep(1) logger.debug("END: PID: %s" % (os.getpid())) sys.exit(1) if __name__ == "__main__": pass
#!/usr/bin/env python import os import sys import time import igraph import logging import operator import log logger = log.custom_logger("Action") class Action: def __init__(self, *arg, **args): self.arg = arg self.args = args def run(self, *arg, **args): pass if __name__ == "__main__": pass if __name__ == "__main__": pass
#!/usr/bin/env python import sys import igraph import log logger = log.custom_logger('Config') sys.path.append("/home/slune/Documents/git") import sequencer as seq from actions.test_print import Test_print def main(): act = Test_print test1 = seq.Item(action=act(cycle=5), hostname="test1.avg.com") test2 = seq.Item(action=act(cycle=5), hostname="test2.avg.com") test3 = seq.Item(action=act(cycle=10), hostname="test3.avg.com") test4 = seq.Item(action=act(cycle=5), hostname="test4.avg.com") test5 = seq.Item(action=act(cycle=5), hostname="test5.avg.com") test6 = seq.Item(action=act(cycle=5), hostname="test6.avg.com") test7 = seq.Item(action=act(cycle=5), hostname="test7.avg.com") test8 = seq.Item(action=act(cycle=12), hostname="test8.avg.com") test9 = seq.Item(action=act(cycle=5), hostname="test9.avg.com") test1.add_exafter(test2) test1.add_exbefore(test1) test1.add_exbefore(test4)
#!/usr/bin/env python import os import sys import time import igraph import operator import log logger = log.custom_logger('Sequencer') class Sequencer: """sequence = { item: { 'sequence': int } } """ def __init__(self): self.start_items = [] self.sequence = {} def get_start(self, items): for it in items: if len(it.after)==0: self.start_items.append(it) return self.start_items