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

Patch: Updates API request to send API key via HTTP only. Deprecates API key via parameters. #170

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

dapineyro
Copy link
Collaborator

@dapineyro dapineyro commented Nov 6, 2024

Overview

This PR changes all the APIkey via parameters to use only HTTP headers. This is a change required to support the upcoming deprecation of APIkey via parameters in cloudos.

Jira

https://lifebit.atlassian.net/browse/LIF-1350

Changes

  • Refactors all API requests in which API key was sent via parameters, to use only HTTP headers.
  • Updates Pytests

Tests

Using docker image:

docker run --rm -it quay.io/lifebitaiorg/cloudos-cli:v2.11.2

Global variables:

MY_API_KEY="xxxx"
CLOUDOS="https://dev.sdlc.lifebit.ai"
WORKSPACE_ID="xxxx"
PROJECT_NAME="davidp_testing"
WORKFLOW_NAME="Cufflinks"
JOB_PARAMS="/cloudos/examples/rnatoy.config"
JOB_NAME="cloudos-cli_QA"

Launch job

cloudos job run \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --project-name "$PROJECT_NAME" \
    --workflow-name $WORKFLOW_NAME \
    --job-config $JOB_PARAMS \
    --job-name $JOB_NAME \
    --resumable  | tee job_status.txt
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS job functionality: run and check jobs in CloudOS.

Executing run...
	No job_queue was specified, using the CloudOS default queue: Default_1.
	Job successfully launched to CloudOS, please check the following link: https://dev.sdlc.lifebit.ai/app/jobs/672ca06fcf949b9103547609
	Your assigned job id is: 672ca06fcf949b9103547609

	Your current job status is: initializing
	To further check your job status you can either go to https://dev.sdlc.lifebit.ai/app/jobs/672ca06fcf949b9103547609 or use the following command:
	cloudos job status \
		--apikey $MY_API_KEY \
		--cloudos-url https://dev.sdlc.lifebit.ai \
		--job-id 672ca06fcf949b9103547609
Screenshot 2024-11-07 at 12 14 00

Check job status

job_id=$(grep -e '--job-id'  job_status.txt | rev | cut -f1 -d " " | rev)
cloudos job status \
    --apikey $MY_API_KEY \
    --cloudos-url $CLOUDOS \
    --job-id $job_id
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS job functionality: run and check jobs in CloudOS.

Executing status...
	Your current job status is: initializing

	To further check your job status you can either go to https://dev.sdlc.lifebit.ai/app/jobs/672ca06fcf949b9103547609 or repeat the command you just used.

Get Job list CSV

cloudos job list \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS job functionality: run and check jobs in CloudOS.

Executing list...
	Job list collected with a total of 30 jobs.
	Job list saved to joblist.csv

Get workflow list CSV

cloudos workflow list \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS workflow functionality: list and import workflows.

Executing list...
	Workflow list collected with a total of 2623 workflows.
	Workflow list saved to workflow_list.csv

Get projects list

cloudos project list \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS project functionality: list projects in CloudOS.

Executing list...
	Project list collected with a total of 976 projects.
	Project list saved to project_list.csv

Import a workflow

cloudos workflow import \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --workflow-url "https://github.com/lifebit-ai/lifebit-platform-gwas" \
    --workflow-name "test_import_github_7" \
    --repository-project-id "30871219" \
    --repository-id "122059362"
CloudOS python package: a package for interacting with CloudOS.

Version: 2.11.2

CloudOS workflow functionality: list and import workflows.

Executing workflow import...

	[Message] Only Nextflow workflows are currently supported.

	Workflow test_import_github_7 was imported successfully with the following ID: 672ca4e63b9051e15ad34dc5
Screenshot 2024-11-07 at 12 33 00

@dapineyro dapineyro marked this pull request as draft November 6, 2024 11:12
@dapineyro dapineyro marked this pull request as ready for review November 6, 2024 11:12
Copy link

@l-mansouri l-mansouri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dapineyro dapineyro merged commit 5b875ad into main Nov 7, 2024
8 checks passed
@dapineyro dapineyro deleted the api_http_request branch November 7, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants