Skip to content

Add JSON report for planemo run invocations#1153

Merged
jmchilton merged 18 commits intogalaxyproject:masterfrom
simonbray:run-report
Jul 12, 2021
Merged

Add JSON report for planemo run invocations#1153
jmchilton merged 18 commits intogalaxyproject:masterfrom
simonbray:run-report

Conversation

@simonbray
Copy link
Member

@simonbray simonbray commented Mar 22, 2021

Fixes #1149.

We could make this way more extensive, e.g. include all job ids, all invocation step ids, etc... For @wm75 and me this would be sufficient at the moment:

{
    "error_message": "",
    "history_id": "e96c6ce43a3d239a",
    "history_state": "ok",
    "invocation_id": "b735ed9e5e005602",
    "invocation_state": "scheduled",
    "workflow_id": "8a72a9a90df70b20"
}

Maybe we can extend it later if there's interest.

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

I think this is a cool start. Maybe you could model the run report after the test report functionality that generates the report from a template (

"""Module describing the planemo ``test_reports`` command."""
) ?

@simonbray
Copy link
Member Author

simonbray commented Mar 22, 2021

I think this is a cool start. Maybe you could model the run report after the test report functionality that generates the report from a template (

"""Module describing the planemo ``test_reports`` command."""

) ?

I don't think we need something human-readable actually - we just want to be able to get the IDs. Wolfgang is parsing planemo -v run atm, which is not really ideal.

(We don't have to use YAML btw, JSON is also fine if you prefer.)

@mvdbeek
Copy link
Member

mvdbeek commented Mar 22, 2021

I don't think the report itself needs to be human readable (as opposed to what the docs say), I think what's cool is that we can start from the same JSON and produce different kind of reports (markdown, HTML, xunit, plain text, yaml).

@simonbray simonbray changed the title Add yaml report for planemo run invocations Add JSON report for planemo run invocations Mar 22, 2021
Copy link
Member

@bgruening bgruening left a comment

Choose a reason for hiding this comment

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

Cool!

@jmchilton
Copy link
Member

I was just hacking on that invocation test report for https://github.com/galaxyproject/planemo/pull/1152/files#diff-27ed15e8e508ef68adea5c98c2025fc3e70937c5d14affdaeaa59b56ba25a6dcR386. It would be nice if this exact JSON is something we could put in the test result JSON somewhere - maybe as a subset of the "data" key or a an "invocation_details" key below "data".

I guess that is just an implementation detail though.

@bgruening
Copy link
Member

@jmchilton do you mean the json structure should look different so it can be reused?

@jmchilton
Copy link
Member

Yeah - let me be more concrete. I think it should be called execution_report instead of invocation_report since run could be done on tools also and in non-Galaxy contexts.

Move:

        invocation_details = {
            'invocation_id': run_result._invocation_id,
            'history_id': run_result._history_id,
            'workflow_id': run_result._workflow_id,
            'invocation_state': run_result.invocation_state,
            'history_state': run_result.history_state,
            'error_message': run_result.error_message,
        }

Into an execution_details() method on the GalaxyWorkflowRunResponse object and with an empty abstract implementation placed in RunResponse.

Then in def structured_test_data(self, run_response): of planemo/runnable.py also place the details in the data_dict.

data_dict['execution_details'] = run_response.execution_details()

That way tooling that is developed around planemo run for workflows can also be used from the JSON for test cases.

@simonbray
Copy link
Member Author

Okay, I'll have a look.

an execution_details() method on the GalaxyWorkflowRunResponse object and with an empty abstract implementation placed in RunResponse.

Aren't we duplicating a lot of stuff here? All this data comes from the GalaxyWorkflowRunResponse in the first place.

@simonbray
Copy link
Member Author

simonbray commented Mar 22, 2021

There seems to be a step missing, structured_test_data is a method of the TestCase class which is not used when running runnables without testing them.

I can probably get it to work (maybe add a structured_test_data method to the RunResponse class as well?) but otherwise maybe you can clarify what you meant @jmchilton?

@jmchilton
Copy link
Member

I think what I was thinking was this - b8cebeb. But now I see there is a thing called invocation_details that is a lot like what I was proposing with execution_details 😆 - of course @mvdbeek did it first and better.

His general idea of making this into a report option would be doable if we ensure this is all in there in this way (which it may already be though - I'm unsure).

@simonbray
Copy link
Member Author

I would be happy to make the simplest change possible:

    invocation_report = kwds.get("invocation_report", None)
    if invocation_report:
        with open(invocation_report, "w") as f:
            json.dump(run_result.invocation_details, f, indent=4, sort_keys=True)

and then modify the collect_invocation_details() method a little bit. But I thought your and @mvdbeek's point was more about making the output compatible with the various report generation options which planemo provides.

But maybe this can be done in a later PR.

@simonbray
Copy link
Member Author

I think this might be ready for a review. It produces an output like this:

image

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

This looks fantastic, thanks a lot @simonbray!

@mvdbeek mvdbeek requested a review from jmchilton July 12, 2021 15:55
@jmchilton jmchilton merged commit e5dd120 into galaxyproject:master Jul 12, 2021
@simonbray simonbray deleted the run-report branch July 13, 2021 09:32
@simonbray simonbray mentioned this pull request Dec 3, 2021
28 tasks
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.

Planemo run should return a short parsable report

4 participants