Skip to content

Commit

Permalink
feat(preprocessing): adapt dummy preprocessing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoran-chen committed Mar 28, 2024
1 parent 8837bcc commit 0849eb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions preprocessing/dummy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
parser.add_argument("--keycloak-password", type=str, default="dummy_preprocessing_pipeline",
help="Keycloak password to use for authentication")
parser.add_argument("--keycloak-token-path", type=str, default="/realms/loculus/protocol/openid-connect/token", help="Path to Keycloak token endpoint")
parser.add_argument("--pipelineVersion", type=int, default=1)

args = parser.parse_args()
backendHost = args.backend_host
Expand All @@ -33,6 +34,7 @@
keycloakUser = args.keycloak_user
keycloakPassword = args.keycloak_password
keycloakTokenPath = args.keycloak_token_path
pipelineVersion = args.pipelineVersion


@dataclass
Expand All @@ -58,7 +60,10 @@ class Sequence:

def fetch_unprocessed_sequences(n: int) -> List[Sequence]:
url = backendHost + "/extract-unprocessed-data"
params = {"numberOfSequenceEntries": n}
params = {
"numberOfSequenceEntries": n,
"pipelineVersion": pipelineVersion
}
headers = {'Authorization': 'Bearer ' + get_jwt()}
response = requests.post(url, data=params, headers=headers)
if not response.ok:
Expand Down Expand Up @@ -136,7 +141,7 @@ def process(unprocessed: List[Sequence]) -> List[Sequence]:
def submit_processed_sequences(processed: List[Sequence]):
json_strings = [json.dumps(dataclasses.asdict(sequence)) for sequence in processed]
ndjson_string = '\n'.join(json_strings)
url = backendHost + "/submit-processed-data"
url = backendHost + "/submit-processed-data?pipelineVersion=" + str(pipelineVersion)
headers = {'Content-Type': 'application/x-ndjson', 'Authorization': 'Bearer ' + get_jwt()}
response = requests.post(url, data=ndjson_string, headers=headers)
if not response.ok:
Expand Down

0 comments on commit 0849eb9

Please sign in to comment.