Example #1
0
def get_job_items(job_id, include_zip=True):
	dynamo_conn = dynamo.get_connection()
	table = dynamo.get_table(dynamo_conn, DYNAMO_JOB_ITEMS_TABLE)
	job_items = dynamo.query_all(table, "job_index", "job_id", job_id)
	link_expiry_secs = 3600 # 1 hour
	s3_conn = s3.S3Connection(VAA3D_USER_AWS_ACCESS_KEY, VAA3D_USER_AWS_SECRET_KEY)
	job_items_list = []
	for item in job_items:
		if include_zip or not zipper.is_compressed_filename(item['input_filename']):
			item_dict = job_item_manager.convert_dynamo_job_item_to_dict(item)
			item_dict['job_item_status'] = JobItemStatus.query.get(int(item_dict['status_id'])).status_name
			output_s3_key = item_dict['output_dir'] + "/" + item_dict['output_filename']
			item_dict['download_url'] = s3.get_download_url(s3_conn, S3_OUTPUT_BUCKET, 
				output_s3_key, link_expiry_secs)
			logs_s3_key = item_dict['output_dir'] + "/logs/" + item_dict['output_filename'] + USER_JOB_LOG_EXT
			item_dict['logs_download_url'] = s3.get_download_url(s3_conn, S3_OUTPUT_BUCKET, 
				logs_s3_key, link_expiry_secs)
			job_items_list.append(item_dict)
	return job_items_list
Example #2
0
def get_job_items(job_id, include_zip=True):
    dynamo_conn = dynamo.get_connection()
    table = dynamo.get_table(dynamo_conn, DYNAMO_JOB_ITEMS_TABLE)
    job_items = dynamo.query_all(table, "job_index", "job_id", job_id)
    link_expiry_secs = 3600  # 1 hour
    s3_conn = s3.S3Connection(VAA3D_USER_AWS_ACCESS_KEY,
                              VAA3D_USER_AWS_SECRET_KEY)
    job_items_list = []
    for item in job_items:
        if include_zip or not zipper.is_compressed_filename(
                item['input_filename']):
            item_dict = job_item_manager.convert_dynamo_job_item_to_dict(item)
            item_dict['job_item_status'] = JobItemStatus.query.get(
                int(item_dict['status_id'])).status_name
            output_s3_key = item_dict['output_dir'] + "/" + item_dict[
                'output_filename']
            item_dict['download_url'] = s3.get_download_url(
                s3_conn, S3_OUTPUT_BUCKET, output_s3_key, link_expiry_secs)
            logs_s3_key = item_dict['output_dir'] + "/logs/" + item_dict[
                'output_filename'] + USER_JOB_LOG_EXT
            item_dict['logs_download_url'] = s3.get_download_url(
                s3_conn, S3_OUTPUT_BUCKET, logs_s3_key, link_expiry_secs)
            job_items_list.append(item_dict)
    return job_items_list
Example #3
0
def save_job_item(job_item):
    conn = dynamo.get_connection()
    table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
    table.put_item(Item=job_item)
Example #4
0
def get_job_item_doc(job_item_key):
    # This can be modified like a dictionary, and saved to Dynamo
    conn = dynamo.get_connection()
    table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
    return dynamo.get(table, job_item_key)
Example #5
0
def store_job_item_doc(job_item_doc):
    conn = dynamo.get_connection()
    table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
    dynamo.insert(table, job_item_doc.as_dict())
Example #6
0
def save_job_item(job_item):
	conn = dynamo.get_connection()
	table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
	table.put_item(Item=job_item)
Example #7
0
def get_job_item_doc(job_item_key):
	# This can be modified like a dictionary, and saved to Dynamo
	conn = dynamo.get_connection()
	table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
	return dynamo.get(table, job_item_key)
Example #8
0
def store_job_item_doc(job_item_doc):
	conn = dynamo.get_connection()
	table = dynamo.get_table(conn, DYNAMO_JOB_ITEMS_TABLE)
	dynamo.insert(table, job_item_doc.as_dict())