Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Workflow/Task Summary Input/Output Json Serialization #2128

Conversation

dsmith-globys
Copy link

This feature allows for users to configure the string serialization method used for WorkflowSummary and TaskSummary Input/Output objects when *Summary classes are created either for storing in ElasticSearch or when being pulled back from ElasticSearch.

For my company's current use-case, all of our microservices which interact with the conductor server API we have running are written in JavaScript, so having the *Summary class Input/Output strings be JSON-serialized means we can trivially interact with the *Summary types in JS instead of trying to hand-parse Java's toString() serialization. Searching for Workflows and Tasks by fields of the input still works as expected regardless of serialization mechanism.

The default Java toString() methodology is kept in place, so the change will not affect any users who do not intentionally enable the summaryInputOutputJsonSerializationEnabled configuration. The configurations were added into the standard server.properties and config.properties (commented out with a note on what they do), and a Unit Test was written to flex the new logic and ensure everything is copacetic.

*NOTE: My original implementation wanted to try and use the Configuration class directly in SummaryUtil, but given the /common/ code is a leaf in the dependency tree and /core/, which has Configuration, is higher in the dependency tree, I had to avoid the dependency circle. To do so, I inserted the BootstrapUtil.configureSummaryUtil call into the Server's main startup function. Please let me know if there would be a better location/manner to handle this, but after trying a few different things, what I currently have seemed the cleanest. I'm more than happy to make adjustments if this doesn't quite meet the standards.

dsmith-globys and others added 5 commits March 11, 2021 17:45
…ed Workflow/TaskSummary classes and the server's ModulesProvider to leverage the configuration, which allows the summary input/output strings to be serialized as JSON strings as opposed to the default configuration of using Java Map toString()
…management and added in tests for the additional features as well as a regression test for expected default behavior
@codecov
Copy link

codecov bot commented Mar 16, 2021

Codecov Report

Merging #2128 (2d88c4b) into dev (a88e274) will decrease coverage by 0.01%.
The diff coverage is 64.28%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev    #2128      +/-   ##
============================================
- Coverage     65.78%   65.76%   -0.02%     
- Complexity     4087     4091       +4     
============================================
  Files           309      310       +1     
  Lines         19252    19270      +18     
  Branches       1758     1758              
============================================
+ Hits          12665    12673       +8     
- Misses         5720     5730      +10     
  Partials        867      867              
Impacted Files Coverage Δ Complexity Δ
...m/netflix/conductor/core/config/Configuration.java 69.23% <0.00%> (-1.83%) 22.00 <0.00> (ø)
...com/netflix/conductor/bootstrap/BootstrapUtil.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ain/java/com/netflix/conductor/bootstrap/Main.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...om/netflix/conductor/common/utils/SummaryUtil.java 66.66% <66.66%> (ø) 4.00 <4.00> (?)
.../com/netflix/conductor/common/run/TaskSummary.java 56.36% <100.00%> (ø) 32.00 <1.00> (ø)
.../netflix/conductor/common/run/WorkflowSummary.java 75.47% <100.00%> (ø) 44.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a88e274...2d88c4b. Read the comment docs.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5173

  • 18 of 28 (64.29%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 70.296%

Changes Missing Coverage Covered Lines Changed/Added Lines %
core/src/main/java/com/netflix/conductor/core/config/Configuration.java 0 1 0.0%
server/src/main/java/com/netflix/conductor/bootstrap/Main.java 0 1 0.0%
common/src/main/java/com/netflix/conductor/common/utils/SummaryUtil.java 8 12 66.67%
server/src/main/java/com/netflix/conductor/bootstrap/BootstrapUtil.java 0 4 0.0%
Totals Coverage Status
Change from base Build 5152: -0.02%
Covered Lines: 13546
Relevant Lines: 19270

💛 - Coveralls

@apanicker-nflx apanicker-nflx merged commit ac987e0 into Netflix:dev Mar 16, 2021
@dsmith-globys dsmith-globys deleted the feature/summary_input_output_json_serialization branch March 16, 2021 16:36
TwoUnderscorez pushed a commit to TwoUnderscorez/conductor that referenced this pull request Jul 23, 2021
* Added configuration for SummaryInputOutputJSONSerialization and updated Workflow/TaskSummary classes and the server's ModulesProvider to leverage the configuration, which allows the summary input/output strings to be serialized as JSON strings as opposed to the default configuration of using Java Map toString()

* Updated Task/Workflow Summary Input/Output Json String configuration management and added in tests for the additional features as well as a regression test for expected default behavior

* Minor whitespace fix in WorkflowSummary

* Another tiny whitespace tweak for WorkflowSummary

* Minor whitespace changes to SummaryUtil
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants