Skip to content
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

Adding additional tests to repo #118

Merged
merged 28 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7b9f169
Add job-info-retrieval test + placeholder tests
Eo300 May 15, 2021
1c673dc
Some pseudocode for test implementation
Eo300 May 15, 2021
50ec602
Add pytest fixtures to initialize buckets/queues
Eo300 May 16, 2021
d3fba1d
Create test for upload_status_file()
Eo300 May 16, 2021
d531aec
Add SQS region to Job Service environment vars
Eo300 May 17, 2021
6cfa436
Add PDB2PQR test for Job Service lambda handler
Eo300 May 17, 2021
ff33f54
Missing newlines
Eo300 May 17, 2021
1040992
Update requirements-dev.txt
Eo300 May 17, 2021
b7da8b1
Formatting via black
Eo300 May 17, 2021
ae2b291
Add test for invalid job handler
Eo300 May 17, 2021
af432b7
Format test_job_service.py via black
Eo300 May 17, 2021
ca038ee
Add "date" to expected values in API Service test
Eo300 May 19, 2021
8cb9325
Add test for successful direct APBS job
Eo300 May 19, 2021
68c9f58
Merge branch 'main' of https://github.com/Electrostatics/apbs-aws int…
Eo300 Jun 7, 2021
1cb3aee
Add missing job_tags
Eo300 Jun 7, 2021
a899668
Added additional development packages
Eo300 Jun 7, 2021
c8b7f8b
Add parameterization for job submission test
Eo300 Jun 9, 2021
8020ef5
Remove individual job submission tests
Eo300 Jun 9, 2021
d4fd8a5
Added test case for APBS job, post-PDB2PQR
Eo300 Jun 9, 2021
b001575
Formatting via black
Eo300 Jun 9, 2021
2652cac
Update template-output.json
Jun 9, 2021
9946ebb
Update test-job_service-output.json
Jun 9, 2021
7e971a2
Update template-input.json
Jun 9, 2021
b0ddb70
Update test-job_service-input.json
Jun 9, 2021
880731f
Update job_service.py
Jun 10, 2021
42fc7ba
Remove FARGATE
intendo Jun 10, 2021
11a1d56
ZZource /Users/d3c572/envs/apbs-aws/bin/activate
intendo Jun 10, 2021
5823080
Update main.yml
mmacduff Jun 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ansible/roles/backend/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,6 @@
environment_variables:
JOB_QUEUE_NAME: "{{ project }}-{{ deployment_group }}-job-q"
OUTPUT_BUCKET: "{{ project }}-{{ deployment_group }}-output"
FARGATE_CLUSTER: "{{ project }}-{{ deployment_group }}-cluster"
FARGATE_SERVICE: "{{ project }}-{{ deployment_group }}-fargate-service"
tags:
Deployment: "{{ deployment_group }}"
tags:
Expand Down
Empty file added lambda_services/__init__.py
Empty file.
7 changes: 3 additions & 4 deletions lambda_services/job_service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
from .launcher.utils import _LOGGER

OUTPUT_BUCKET = getenv("OUTPUT_BUCKET")
FARGATE_CLUSTER = getenv("FARGATE_CLUSTER")
FARGATE_SERVICE = getenv("FARGATE_SERVICE")
# Could use SQS URL below instead of a queue name; whichever is easier
SQS_QUEUE_NAME = getenv("JOB_QUEUE_NAME")
JOB_QUEUE_REGION = getenv("JOB_QUEUE_REGION", "us-west-2")
JOB_MAX_RUNTIME = int(getenv("JOB_MAX_RUNTIME", 2000))

# Initialize logger
Expand Down Expand Up @@ -125,7 +124,7 @@ def build_status_dict(
def upload_status_file(object_filename: str, initial_status_dict: dict):
"""Upload the initial status object to S3

:param object_filename str: the name of the file to download
:param object_filename str: the S3 object key of the file to download
:param initial_status_dict dict: a JSON-compatible dictionary containing
initial status info of the job
"""
Expand Down Expand Up @@ -235,7 +234,7 @@ def interpret_job_submission(event: dict, context):
"command_line_args": job_command_line_args,
"max_run_time": timeout_seconds,
}
sqs_client = resource("sqs")
sqs_client = resource("sqs", JOB_QUEUE_REGION)
queue = sqs_client.get_queue_by_name(QueueName=SQS_QUEUE_NAME)
_LOGGER.info("%s Sending message to queue: %s", job_tag, sqs_json)
queue.send_message(MessageBody=dumps(sqs_json))
4 changes: 2 additions & 2 deletions lambda_services/job_service/launcher/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def s3_object_exists(bucket_name: str, object_name: str) -> bool:
)
return True
except ClientError as err:
if err.response["Error"]["Message"] == "NoSuchKey":
if err.response["Error"]["Code"] == "404": # "NoSuchKey" error
return False
elif err.response["Error"]["Message"] == "Forbidden":
elif err.response["Error"]["Code"] == "403":
job_tag: str = _extract_job_tag_from_objectname(object_name)
_LOGGER.warning(
"%s Received '%s' (%d) message on object HEAD: %s",
Expand Down
Empty file.
7 changes: 7 additions & 0 deletions lambda_services/tests/expected_data/template-output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"name": "",
"sqs_message": {},
"initial_status": {}
}
]
93 changes: 93 additions & 0 deletions lambda_services/tests/expected_data/test-job_service-output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[
{
"name": "apbs-direct",
"sqs_message": {
"job_id": "sampleId",
"job_type": "apbs",
"job_date": "2021-05-16",
"job_tag": "2021-05-16/sampleId",
"bucket_name": "pytest_input_bucket",
"input_files": [
"2021-05-16/sampleId/1fas.in",
"2021-05-16/sampleId/1fas.pqr"
],
"command_line_args": "1fas.in",
"max_run_time": 7200
},
"initial_status": {
"jobid": "sampleId",
"jobtype": "apbs",
"apbs": {
"status": "pending",
"startTime": 1623172892.2588568,
"endTime": null,
"subtasks": [],
"inputFiles": [
"2021-05-16/sampleId/1fas.in",
"2021-05-16/sampleId/1fas.pqr"
],
"outputFiles": []
}
}
},
{
"name": "apbs-post_pdb2pqr",
"sqs_message": {
"job_id": "sampleId",
"job_type": "apbs",
"job_date": "2021-05-16",
"job_tag": "2021-05-16/sampleId",
"bucket_name": "pytest_input_bucket",
"input_files": [
"2021-05-16/sampleId/1fas.pqr",
"2021-05-16/sampleId/apbsinput.in"
],
"command_line_args": "apbsinput.in",
"max_run_time": 7200
},
"initial_status": {
"jobid": "sampleId",
"jobtype": "apbs",
"apbs": {
"status": "pending",
"startTime": 1623172892.2588568,
"endTime": null,
"subtasks": [],
"inputFiles": [
"2021-05-16/sampleId/1fas.pqr",
"2021-05-16/sampleId/apbsinput.in"
],
"outputFiles": []
}
}
},
{
"name": "pdb2pqr-v1-basic",
"sqs_message": {
"job_date": "2021-05-16",
"job_id": "sampleId",
"job_tag": "2021-05-16/sampleId",
"job_type": "pdb2pqr",
"bucket_name": "pytest_input_bucket",
"input_files": [
"https://files.rcsb.org/download/1fas.pdb"
],
"command_line_args": "--with-ph=7.0 --ph-calc-method=propka --drop-water --apbs-input --ff=parse --verbose 1fas.pdb sampleId.pqr",
"max_run_time": 2700
},
"initial_status": {
"jobid": "sampleId",
"jobtype": "pdb2pqr",
"pdb2pqr": {
"status": "pending",
"startTime": 1623261174.8676486,
"endTime": null,
"subtasks": [],
"inputFiles": [
"https://files.rcsb.org/download/1fas.pdb"
],
"outputFiles": []
}
}
}
]
27 changes: 27 additions & 0 deletions lambda_services/tests/input_data/1fas.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
read
mol pqr 1fas.pqr
end
elec
mg-auto
dime 129 97 97
cglen 63.1108 45.7300 61.4601
fglen 57.1240 45.7300 56.1530
cgcent mol 1
fgcent mol 1
mol 1
lpbe
bcfl sdh
pdie 2.0000
sdie 78.5400
srfm smol
chgm spl2
sdens 10.00
srad 1.40
swin 0.30
temp 298.15
calcenergy total
calcforce no
write pot dx 1fas.pqr
end
print elecEnergy 1 end
quit
Loading