question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delocalization not working when using Structs as outputs

See original GitHub issue

I could not find on WDL spec something saying that structs could not be used as outputs… so I decide to report here.

This is an example I prepared:

version 1.0

struct Test {
    String name
    File path
}

struct Collection {
    Array[Test] samples
}


task GenerateComplexObject {
    input {
        Int items
    }

    command <<<
        python <<CODE
        import sys
        import os
        import json
        items = []
        for item in range(0, ~{items}):
            name = f"test{item}.txt"
            os.system(f"echo 'some content' >  {name}")
            items.append({"name": f"item-{item}", "path": name})

        with open("results.json", "w") as fh:
            json.dump({'samples': items}, fh)
        CODE
    >>>

    runtime {
        docker: "python:3.8"
        memory: "1 GB"
        cpu: 1
        preemptible: 3
        disks: "local-disk " + 10 + " HDD"
    }

    output {
        Collection results = read_json("results.json")
    }
}


workflow TestStruct {
    input {
        Int items
    }

    call GenerateComplexObject {
        input:
            items=items
    }

    output {
        Collection out = GenerateComplexObject.results
    }
}

When using local backend I have no problem, but when using PAPIv2 (cromwell.backend.google.pipelines.v2alpha1.PipelinesApiLifecycleActorFactory) the files from Test struct (path) do not delocalize.

gsutil ls gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/GenerateComplexObject.log
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/gcs_delocalization.sh
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/gcs_localization.sh
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/gcs_transfer.sh
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/rc
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/results.json
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/script
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/stderr
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/stdout
gs://********/TestaStruct/47bc869c-041f-443d-b0bd-d45a1dd203ff/call-GenerateComplexObject/pipelines-logs/

Is it possible to use structs as intended on the example? I’m using Cromwell 52, do not know if it works in previous versions.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rsaschcommented, Sep 21, 2020

I created a bug issue in our Jira issue tracker: https://broadworkbench.atlassian.net/browse/WA-358

0reactions
Coppinicommented, Jan 20, 2022

Still experiencing this problem. It seems we cannot use Array[File] inside structs for now.

version development
​
workflow Test {
    input {
        String file_name = "file.txt"
        String file_contents = "teste"
    }
​
    call WriteFile {
        input:
            file_name=file_name,
            file_contents=file_contents
    }
​
    Array[File] array_file = [WriteFile.output_file, WriteFile.output_file]
​
    MultiTypeStruct test_struct = {
        "file_name" : file_name,
        "file" : WriteFile.output_file,
        "array_file" : array_file
    }
​
    output {
        MultiTypeStruct multi_type_struct_test = test_struct
    }
}
​
struct MultiTypeStruct {
    String file_name
    File file
    Array[File] array_file
}
​
task WriteFile {
    input {
        String file_name
        String file_contents
    }
​
    command <<<
        echo -e """~{file_contents}""" > ~{file_name}
    >>>
​
    runtime {
        docker: "gcr.io/google.com/cloudsdktool/cloud-sdk:330.0.0-alpine"
        preemptible: 3
    }
​
    output {
        File output_file = "~{file_name}"
    }
}

You can easily see an error happening when running a simple workflow like this. As long as you have an Array[File] inside a struct, it will keep on failing. In my case, I’m using version development, and the last task on the workflow simply gets stuck with status Running while the workflow itself moves to status Aborting and stays stuck permanently in Aborting (never actually moving its status to Aborted).

Experienced this issue with Cromwell versions 63 and 74, while using GCP lifescience v2 backend.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with Delocalization | Depth-First
It can work for problems like exact structure match, but fails in any context that treats atomic hydrogen count, subvalence, or hybridization as ......
Read more >
Correcting pi-delocalization errors in conformational energies ...
Correcting pi-delocalization errors in conformational energies using density-corrected DFT, with application to crystal polymorphs.
Read more >
Delocalization of exciton and electron wavefunction in non ...
Therefore, in this report, we study Y6-based OSCs using a combination of single-crystal investigations, thin film morphology analysis (grazing ...
Read more >
Bonding Character, Electron Delocalization, and Aromaticity of ...
So, in this work, the bonding character and electron delocalization of three C18 precursors, C18-(CO)n (n=6, 4, and 2), are analyzed in ...
Read more >
Electron Delocalization - an overview | ScienceDirect Topics
Molecular geometry as a source of electronic structure of π-electron systems and ... To some extent, problems with HOMA may arise from (i)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found