def test_03_projects_init(self): proj_diary = project.Project(name='Diary', fldr=root_folder, desc='Diary database for PIM application') proj_diary.add_source('Calendar', root_folder) proj_diary.add_source('Bookmarks', root_folder) proj_diary.add_source('File Usage', root_folder) proj_diary.add_source('PC Usage', root_folder) proj_diary.add_source('TODO List', root_folder) proj_diary.log_table('Tasks.log') self.assertEqual(len(str(proj_diary)) > 5, True) my_biz = project.Project(name='Acute Software', desc='Custom Software development', fldr='') my_biz.add_detail('website', 'http://www.acutesoftware.com.au') my_biz.add_detail('email', '*****@*****.**') self.assertEqual(len(str(my_biz)) > 5, True) all_projects = project.Projects() all_projects.add_project(proj_diary) all_projects.add_project(my_biz) all_projects.add_ontology('mapping') res = all_projects.get_by_name('Diary') self.assertEqual(res.desc, 'Diary database for PIM application') self.assertEqual(len(all_projects.project_list), 2) self.assertEqual(len(str(all_projects)), 134) self.assertEqual(all_projects.get_by_name('No such project'), None)
def main(): # define the project prj_random = prj.Project(name='Random Information Request', desc=desc, fldr=proj_fldr) # add sources of data prj_random.add_source('Root Ontology', os.path.abspath(os.path.join(src_fldr, 'data','ref', 'ontology.yaml'))) #prj_random.add_source('Toolboxes', os.path.abspath(os.path.join(src_fldr, 'data','ref', 'toolbox.csv'))) # parse the request for possible toolboxes to use based on local ontology keywords = [] for s in prj_random.data_sources: with open(s[1], 'r') as f: for line in f: print(s[1], ' = ' , line) for word in line.split(' '): keywords.append(word.strip('\n').strip(' ')) # a. split request into words # b. lookup local ontology of words to concepts # c. lookup toolboxes that match the concepts print(list(set(keywords))) # test the matching toolboxes on the source data # a. run the test on each toolboxes # b. compare test results and attempt to rank results all_projects = prj.Projects() all_projects.add_ontology('researcher') all_projects.add_project(prj_random) print(prj_random)
def test_03_projects_init(self): proj_diary = project.Project(name='Diary', fldr=root_folder, desc='Diary database for PIM application') proj_diary.add_source('Calendar', root_folder) proj_diary.add_source('Bookmarks', root_folder) proj_diary.add_source('File Usage', root_folder) proj_diary.add_source('PC Usage', root_folder) proj_diary.add_source('TODO List', root_folder) my_biz = project.Project(name='Acute Software', type='business', desc='Custom Software development', fldr='') my_biz.add_detail('website', 'http://www.acutesoftware.com.au') my_biz.add_detail('email', '*****@*****.**') all_projects = project.Projects() all_projects.add_project(proj_diary) all_projects.add_project(my_biz) self.assertEqual(len(all_projects.project_list), 2) self.assertEqual(len(str(all_projects)), 134)
def main(): # define projects pim_projects = prj.Projects() pim_projects.add_project(gmail()) pim_projects.add_project(outlook()) pim_projects.add_project(file_metadata()) print(pim_projects) # setup tools needed tools = mod_tool.Toolbox() tools.add({ 'name': 'email download', 'file': myfldr + 'download_email.py', 'interval': 'Daily' }) tools.add({ 'name': 'email process', 'file': myfldr + 'process_email.py', 'interval': 'Daily' })
def test_13_run_all_tasks(self): """ uses dummy_function as func to execute tasks """ proj13 = project.Project(name='Maths Calc', fldr=root_folder, desc='run simple maths functions') t1 = project.Task(1, 'task_1', dummy_function) t1.add_param(param_key='a_number', param_val=3) t1.add_param(param_key='b_number', param_val=2) t1.add_param(param_key='__success_test', param_val=6) t2 = project.Task(2, 'task_1', dummy_function) t2.add_param(param_key='a_number', param_val=4) t2.add_param(param_key='b_number', param_val=10) t2.add_param(param_key='__success_test', param_val=40) proj13.add_task(t1) proj13.add_task(t2) proj13.add_detail('info', 'This project runs a seris of calculations') dummy_projects = project.Projects() dummy_projects.add_project(proj13) #proj13.execute_tasks() dummy_projects.run()