-
Notifications
You must be signed in to change notification settings - Fork 10
Feature: Better config modularity & alignment to nf-core config #268
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
base: master
Are you sure you want to change the base?
Conversation
…ions Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
… conditions in static Test: Added tests to new classes Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Test: Added tests for file configs Signed-off-by: JosuaCarl <[email protected]>
Feature: Added additional file options Test: Adjusted test for CO2FootprintConfig integration of trace, summary, report Signed-off-by: JosuaCarl <[email protected]>
…nabled Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Test: Adjusted Tests to new config Signed-off-by: JosuaCarl <[email protected]>
…ections Signed-off-by: JosuaCarl <[email protected]>
…onfiguration.md Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
Fix: Small fix for nested values Signed-off-by: JosuaCarl <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments I have so far, I will continue tomorrow, it's a loooot :D
plugins/nf-co2footprint/src/main/nextflow/co2footprint/CO2FootprintConfig.groovy
Outdated
Show resolved
Hide resolved
Double getCi() { evaluate('ci') } | ||
Double getCiMarket() { evaluate('ciMarket') } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double getCi() { evaluate('ci') } | |
Double getCiMarket() { evaluate('ciMarket') } | |
/** | |
* Returns the carbon intensity value. | |
* If set as a closure (for real-time API), invokes it to get the current value. | |
*/ | |
Double getCi() { evaluate('ci') } | |
/** | |
* Returns the personal energy mix carbon intensity value. | |
* If set as a closure (in case user defined a function for it in the config), invokes it to get the current value. | |
*/ | |
Double getCiMarket() { evaluate('ciMarket') } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally deleted the comments, because the functionality should be clear form the commented evaluate
function. I would rather modify this and keep the flow of the get
methods.
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/BaseConfig.groovy
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/BaseConfig.groovy
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigParameters.groovy
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigParameters.groovy
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigParameters.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigParameters.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigParameters.groovy
Outdated
Show resolved
Hide resolved
Signed-off-by: JosuaCarl <[email protected]>
Signed-off-by: JosuaCarl <[email protected]>
plugins/nf-co2footprint/src/main/nextflow/co2footprint/CO2FootprintObserver.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/Config/ConfigEntry.groovy
Outdated
Show resolved
Hide resolved
String toString() { | ||
return "${name}: ${value} (${allowedTypes} -> ${returnType})${description ? '\n' + description: ''}" | ||
} | ||
|
||
/** | ||
* A Map representation of the parameter. | ||
* @return Map representation | ||
*/ | ||
Map<String, ?> toMap() { | ||
return [name: name, value:value, allowedTypes: allowedTypes, returnType: returnType, description: description] | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are those functions needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toString
is mostly for debugging. The debugger calls the method to describe the instance. I found it really helpful and would definitely keep this.
toMap
was intended for easier testing. Although I think I did not end up using it. But then again, I could also expand on the test of the class.
|
||
@Slf4j | ||
class ConfigParameters { | ||
final private HashMap<String, ConfigEntry> vault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm shouldn't variable names be as descriptive as possible and not have vague names? And storage or vault is super generic and not descriptive for that variable
plugins/nf-co2footprint/src/main/nextflow/co2footprint/FileCreators/BaseFile.groovy
Outdated
Show resolved
Hide resolved
plugins/nf-co2footprint/src/main/nextflow/co2footprint/FileCreators/BaseFile.groovy
Show resolved
Hide resolved
Signed-off-by: JosuaCarl <[email protected]>
Related Issues
{traceFile: path/to/file.txt}
, whereas nf-core uses{trace: [file: path/to/file.txt]}
🎯 Motivation
📋 Summary of changes
BaseConfig
class for configurations to make repetitive calls upon methods in a config easierConfigEntry
to define entries of our config with desired attributes, including dynamic default initialization, type checking on every value change, nested Configurations setting, initialization indicationCO2Footprint
from naming of nested classes, to avoid redundancy and long names📌 Important details
overwrite
&maxTasks
) configurable for the respective files✅ Checklist
test
reflects class structure inmain
README.md
contains information on or reference to new featuresCHANGELOG.md
is updated with a note on your changes.\gradlew check
)