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

Read CWLs without storing them #26

Open
Ambivalentalfa opened this issue Aug 27, 2024 · 2 comments
Open

Read CWLs without storing them #26

Ambivalentalfa opened this issue Aug 27, 2024 · 2 comments

Comments

@Ambivalentalfa
Copy link
Collaborator

          The file could be read without storing it I think. I assume that you will receive 1 workflow in CWL and you can verify and parse it without storing it locally, something similar to:
async def score_workflows(file: UploadFile = File(...)):
    # Read the contents of the uploaded file
    contents = await file.read()
    
    # Parse the YAML content as a CWL workflow (this tests whether the file is a YAML file)
    try:
        cwl_content = yaml.safe_load(contents)
    except yaml.YAMLError as e:
        return {"error": "Invalid YAML file", "details": str(e)}
    
    # Extract information from the CWL workflow
    extracted_info = extract_info_from_cwl(cwl_content)

_Originally posted by @vedran-kasalica in https://github.com/Workflomics/workflomics-QCmetric/pull/22#discussion_r1716904798_
            
@Ambivalentalfa Ambivalentalfa self-assigned this Aug 29, 2024
@Ambivalentalfa
Copy link
Collaborator Author

pubmetric.workflows.parse_cwl currently takes a filepath and then opens them inside the method. Need to make this optional or change to take an open file.

@Ambivalentalfa Ambivalentalfa removed their assignment Aug 31, 2024
@Ambivalentalfa
Copy link
Collaborator Author

The reason it does that is because cwl_utils.parsers' load_document_by_uri takes a filepath not a file.

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

No branches or pull requests

1 participant