Exemplo n.º 1
0
def main():
	parser = OptionParser()
	parser.add_option("-t", "--task-id", dest="task_id", default=None)
	parser.add_option("-c", "--config-path", dest="config_path", default=None)
	(options, args) = parser.parse_args()
	task_id = options.task_id
	config_path = options.config_path

	task_dao = TaskDao.TaskDao(ConnectionUtil.get_connection(config_path))
	job_run_dao = JobRunDao.JobRunDao(ConnectionUtil.get_connection(config_path))

	if (task_id is not None):
		run_by_task_id(job_run_dao, task_dao, task_id)
	else:
		run_all(job_run_dao, task_dao)
Exemplo n.º 2
0
import Task
import ConnectionUtil
import TaskDao
import JobRunDao

TASK_DAO = TaskDao.TaskDao(ConnectionUtil.get_connection("config.cfg"))
JOB_RUN_DAO = JobRunDao.JobRunDao(ConnectionUtil.get_connection("config.cfg"))

def test_insert():
	t1 = Task.Task(0, "task name", "monthly", 1, 3, 6, 3, "eicho hello", "my_folder2")
	TASK_DAO.insert(t1)
	t2 = Task.Task(0, "task name", "monthly", 1, 3, 6, 3, "echo bye", "my_folder1")
	TASK_DAO.insert(t2)

def test_select_all():
	res = TASK_DAO.select_all()
	for task in res:
		print task.to_string()

def test_load_by_id():
	t1 = Task.Task(0, "task name", "monthly", 1, 3, 6, 3, "echo hello", "my_folder1")
	inserted_task_id = TASK_DAO.insert(t1)
	res  = TASK_DAO.load_by_id(inserted_task_id)
	for task in res:
		print task.to_string()


def main():
	JOB_RUN_DAO.truncate()
	TASK_DAO.truncate()
	test_insert()
Exemplo n.º 3
0
import JobRun
import ConnectionUtil
import JobRunDao

JOB_RUN_DAO = JobRunDao.JobRunDao(ConnectionUtil.get_connection())

def test_insert():
	j1 = JobRun.JobRun(0, 3, "", "", JobRun.STATUS_RUNNING) 
	job_run_id = JOB_RUN_DAO.insert(j1)
	return job_run_id

def test_select():
	job_runs = JOB_RUN_DAO.select_all()
	for job_run in job_runs:
		print(job_run.to_string())

def test_end_job(job_run_id):
	JOB_RUN_DAO.end_job(job_run_id, JobRun.STATUS_SUCCESS)

def main():
	JOB_RUN_DAO.truncate()
	job_run_id = test_insert()
	test_select()
	test_end_job(job_run_id)
	test_select()



if __name__ == "__main__":
	main()