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

Develop #789

Merged
merged 82 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
d19a0d3
Disable any reflection & circe calls as it was tripping over its toes
Grifs Aug 8, 2024
76595ff
Merge branch 'develop' into feature/scala3
Grifs Aug 29, 2024
f9226ab
Start re-enabling circe calls with replaced encoder and decoders
Grifs Aug 29, 2024
673570b
Start to re-enable decoders and encoders
Grifs Aug 29, 2024
b186934
fudge BuildStatus type to assist type matching, set max-inlines in sb…
Grifs Aug 29, 2024
1b8d8ae
re-enable json encoding and decoding calls that were previously disabled
Grifs Aug 29, 2024
e30ee82
Fix another handful of issues, start to fix some tests
Grifs Aug 29, 2024
c9d10b8
Fix another bunch of issues with testbenches
Grifs Aug 29, 2024
0e0c620
post release changes
Grifs Sep 3, 2024
b008154
Re-enable code & provide temporary methods as needed. Further cleanup
Grifs Sep 5, 2024
664a782
minor cleanup
Grifs Sep 5, 2024
dfdf294
fix temporary code still being present
Grifs Sep 5, 2024
ef49859
Tweak how the encoder & decoder placeholders are formatted
Grifs Sep 5, 2024
25891ca
remove all stripMargins from field case class annotations
Grifs Sep 5, 2024
9ed9d94
Add custom encoder & decoder for Status enum
Grifs Sep 12, 2024
b299ac9
Add back some validation code to assist with invalid fields
Grifs Sep 12, 2024
3e9da39
provide safeguard to solve empty packageconfig issues
Grifs Sep 12, 2024
83aaaee
Start using reflection to get class name and fields
Grifs Sep 12, 2024
8d422d0
reactivate some code
Grifs Sep 13, 2024
e39672c
fix broken indentation
Grifs Sep 13, 2024
c618e01
treat warnings as errors
rcannood Sep 25, 2024
10866d9
update changelog
rcannood Sep 25, 2024
daa4929
function was renamed
rcannood Sep 25, 2024
fd79c50
Start progressing to Circe to use mirroring directly instead of going…
Grifs Sep 27, 2024
4fde75b
Add implementation of fieldsInternalFunctionality
Grifs Sep 27, 2024
f7e2d0b
add deprecation & removal annotation code
Grifs Sep 28, 2024
ba38803
Refactor mirror method names
Grifs Sep 28, 2024
0d98639
Fix empty package configs failing as it gets parsed as `false`
Grifs Sep 28, 2024
7d84d7d
rename `niceNameOf` to `typeOf` and improve output of e.g. List[String]
Grifs Sep 28, 2024
5377ef5
use packages.viash-hub.com for git clone
Grifs Oct 10, 2024
3120e0b
Update CHANGELOG.md
Grifs Oct 10, 2024
8a6db29
Fix/gha (#775)
Grifs Oct 10, 2024
a5dff62
Merge remote-tracking branch 'origin/develop' into feature/move_viash…
Grifs Oct 10, 2024
7563ae8
Merge pull request #774 from viash-io/feature/move_viashhub_url
Grifs Oct 10, 2024
58c22e1
Fix readWithInjection possibly receiving None values
Grifs Oct 17, 2024
8c5f846
Add changelog entry
Grifs Oct 17, 2024
0bdd703
Improve error message a bit more
Grifs Oct 17, 2024
df0890f
Fix code changes highlighted by testbench failures
Grifs Oct 22, 2024
0d43d09
Add a short testbench to verify that non-existing packages indeed ret…
Grifs Oct 22, 2024
beb6ad5
Make changelog consistent
rcannood Oct 22, 2024
417a3a8
Merge pull request #776 from viash-io/fix/missing_resource_stacktrace
Grifs Oct 22, 2024
b6d9222
Merge branch 'develop' into r-treat-warnings-as-errors
rcannood Oct 22, 2024
2c731e7
Allow single quotes to be used again in .script
Grifs Oct 22, 2024
b6fcca7
Merge pull request #771 from viash-io/r-treat-warnings-as-errors
Grifs Oct 22, 2024
df4cd60
Reduce disabled code by adding more placeholders
Grifs Oct 24, 2024
737465a
Bump scala to 3.3.4, solve some new warnings and reduce inline code s…
Grifs Oct 24, 2024
b5bdee4
Add code to get class annotations, step towards getting it for member…
Grifs Oct 25, 2024
343ecde
add member annotation reflection and create the full annotation struc…
Grifs Nov 7, 2024
7eb9a8f
make getMembers inline so we don't lose the T type
Grifs Nov 14, 2024
ac012a1
Nextflow: fix incorrect flagging of output as missing input (#778)
DriesSchaumont Nov 14, 2024
2cd2130
Get annotations of subclass fieldMembers too and flatten everything
Grifs Nov 14, 2024
7639aba
strip unused code (after some tweaking to make it completely unused)
Grifs Nov 15, 2024
77ba97a
Improve which fields get annotated
Grifs Nov 18, 2024
9008852
Fix type values of class members
Grifs Nov 22, 2024
3473615
Tweak mirroring to output thing in the format we want, always stripMa…
Grifs Nov 22, 2024
583f144
remove .stripMargin from annotations. Regardless of being in comments…
Grifs Nov 22, 2024
e3cdc9b
cleanup mirroring code
Grifs Nov 22, 2024
b2dc774
prune some stale code
Grifs Nov 22, 2024
88c8ef2
try splitting into 3 parts
Grifs Nov 22, 2024
7f4d5fe
Cleanup of changed code, removing some code put in comments etc
Grifs Nov 22, 2024
e7a05fb
Revert circe to slightly older packages
Grifs Nov 28, 2024
25d5e41
cleanup status enum circe code & switch Logger to use enums too
Grifs Dec 5, 2024
9a4b0ba
Minor code cleanup
Grifs Dec 5, 2024
d1b0920
Update src/main/scala/io/viash/helpers/circe/DeriveConfiguredDecoderW…
Grifs Dec 5, 2024
bf1c76b
Update src/main/scala/io/viash/helpers/circe/DeriveConfiguredDecoderW…
Grifs Dec 5, 2024
381b0c0
Install nextflow after java and other supporting languages (#780)
Grifs Dec 5, 2024
b9b2a90
Merge remote-tracking branch 'origin/develop' into feature/scala3
Grifs Dec 6, 2024
3e33053
FEAT: asynchronous publishing for the nextflow runner. (#736)
DriesSchaumont Dec 9, 2024
e514e9c
Add changelog entry, fixes for website output
Grifs Dec 9, 2024
4c8cb7d
Remove testbench for method that was removed
Grifs Dec 9, 2024
570b10f
Merge pull request #759 from viash-io/feature/scala3
Grifs Dec 9, 2024
f365280
Add Scope & ScopeEnum classes. Add .scope in config
Grifs Dec 9, 2024
ef474ea
Add tests for scope handling
Grifs Dec 10, 2024
7cdc262
add changelog entry
Grifs Dec 10, 2024
cce1752
Add scope into the target folder name
Grifs Dec 11, 2024
e3e674b
Merge pull request #782 from viash-io/feature/scope_publishmode
Grifs Dec 11, 2024
33dcde5
add `---` parameter to component help messages (#784)
Grifs Dec 16, 2024
573fbb2
update actions (#787)
rcannood Dec 16, 2024
ee632f0
display help message for illegal command instead of hanging in an inf…
Grifs Dec 16, 2024
a00a1d5
Merge pull request #788 from viash-io/fix/configure_script_loose_matc…
Grifs Dec 16, 2024
95a07d4
set sbt version, finalize changelog
Grifs Dec 16, 2024
6fe9985
Mark conversion enabled explicitly (#790)
Grifs Dec 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ns_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up sbt
- name: Set up java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'

- name: Set up sbt
uses: sbt/setup-sbt@v1

- name: Build viash
run: |
echo "${HOME}/.local/bin" >> $GITHUB_PATH
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/sbt_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: viash-io/viash-actions/update-docker-engine@v5
- uses: viash-io/viash-actions/project/update-docker-engine@v6
if: runner.os == 'Linux'

- name: Set up Nextflow
if: ${{ runner.os == 'Linux' && matrix.java.run_nextflow }}
uses: nf-core/setup-nextflow@v1
with:
version: ${{ matrix.java.nxf_ver }}

- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -42,18 +36,14 @@ jobs:
processx
testthat

- name: Set up java & sbt
- name: Set up java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java.ver }}

- name: Set up sbt specifically on macOS on arm64 if needed
if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64'}}
run: |
if ! command -v sbt &> /dev/null; then
brew install sbt
fi
- name: Set up sbt
uses: sbt/setup-sbt@v1

- name: Set up Scala
run: |
Expand All @@ -69,6 +59,12 @@ jobs:
with:
python-version: '3.x'

- name: Set up Nextflow
if: ${{ runner.os == 'Linux' && matrix.java.run_nextflow }}
uses: nf-core/setup-nextflow@v2
with:
version: ${{ matrix.java.nxf_ver }}

- name: Run tests
run: |
if [[ "${{ matrix.config.name }}" =~ ^ubuntu.*$ ]] && [[ "${{ matrix.java.run_coverage }}" == "true" ]]; then
Expand Down
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# Viash 0.9.1 (2024-12-16): Enhanced nextflow support and Scala 3 update

Workflows can now publish results asynchronously by emitting multiple output channels. These results will then be merged into a published output behind the screens.
Dependencies will use the new dedicated git url instead of the top level domain name.

## NEW FEATURES

* `Nextflow` runner: allow emitting multiple output channels (PR #736).

* `Scope`: Add a `scope` field to the config (PR #782). This allows tuning how the components is built for release.

## MINOR CHANGES

* `viash-hub`: Change the url for viash-hub Git access to packages.viash-hub.com (PR #774).

* `RRequirements`: Allow single quotes to be used again in the `.script` field (PR #771).

* `scala`: Update Scala to Scala 3 (PR #759).
For most of the code, this was a minor update, so no breaking changes are expected.
The biggest change is how the exporting of the schema is done, but this has no impact on the user.
However, switching to Scala 3 allows for additional features and improvements in the future.

* `--help`: Component `--help` messages will now display what built in `---` options are available (PR #784).

## BUG FIXES

* `config build`: Fix a bug where a missing main script would cause a stack trace instead of a proper error message (PR #776).
The error message showed the path of the missing resource but it was easy to miss given the stack trace, besides it shouldn't have been a stack trace anyway.

* `RRequirements`: Treat warnings as errors when installing R dependencies in Docker engines (PR #771).

* `Nextflow` runner: fix false-positive error when output argument arguments `required: true`
are incorrectly flagged as missing input arguments (PR #778).

# Viash 0.9.0 (2024-09-03): Restructure platforms into runners and engines

This release restructures the introduces changes to the Viash config:
Expand Down
25 changes: 15 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
name := "viash"

version := "0.9.0"
version := "0.9.1"

scalaVersion := "2.13.14"
scalaVersion := "3.3.4"

libraryDependencies ++= Seq(
"org.scalactic" %% "scalactic" % "3.2.15" % "test",
"org.scalatest" %% "scalatest" % "3.2.15" % "test",
"org.rogach" %% "scallop" % "5.0.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1",
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4",
"com.github.julien-truffaut" %% "monocle-core" % "2.1.0",
"com.github.julien-truffaut" %% "monocle-macro" % "2.1.0"
"dev.optics" %% "monocle-core" % "3.1.0",
"dev.optics" %% "monocle-macro" % "3.1.0"
)

val circeVersion = "0.14.1"
val circeVersion = "0.14.7"

libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser",
"io.circe" %% "circe-generic-extras",
"io.circe" %% "circe-optics",
"io.circe" %% "circe-yaml"
// "io.circe" %% "circe-generic-extras",
// "io.circe" %% "circe-optics",
// "io.circe" %% "circe-yaml"
).map(_ % circeVersion)

scalacOptions ++= Seq("-unchecked", "-deprecation")
libraryDependencies ++= Seq(
"io.circe" %% "circe-optics" % "0.15.0",
"io.circe" %% "circe-yaml" % "0.15.2",
)

scalacOptions ++= Seq("-unchecked", "-deprecation", "-explain")
scalacOptions ++= Seq("-Xmax-inlines", "50")

organization := "Data Intuitive"
startYear := Some(2020)
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ while [ $# -gt 0 ]; do
prefix="$2"
shift 2
;;
--help)
*)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Map _processInputValues(Map inputs, Map config, String id, String key) {
if (!workflow.stubRun) {
config.allArguments.each { arg ->
if (arg.required) {
if (arg.required && arg.direction == "input") {
assert inputs.containsKey(arg.plainName) && inputs.get(arg.plainName) != null :
"Error in module '${key}' id '${id}': required input argument '${arg.plainName}' is missing"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
Map _processOutputValues(Map outputs, Map config, String id, String key) {
Map _checkValidOutputArgument(Map outputs, Map config, String id, String key) {
if (!workflow.stubRun) {
config.allArguments.each { arg ->
if (arg.direction == "output" && arg.required) {
assert outputs.containsKey(arg.plainName) && outputs.get(arg.plainName) != null :
"Error in module '${key}' id '${id}': required output argument '${arg.plainName}' is missing"
}
}

outputs = outputs.collectEntries { name, value ->
def par = config.allArguments.find { it.plainName == name && it.direction == "output" }
assert par != null : "Error in module '${key}' id '${id}': '${name}' is not a valid output argument"
Expand All @@ -18,3 +11,14 @@ Map _processOutputValues(Map outputs, Map config, String id, String key) {
}
return outputs
}

void _checkAllRequiredOuputsPresent(Map outputs, Map config, String id, String key) {
if (!workflow.stubRun) {
config.allArguments.each { arg ->
if (arg.direction == "output" && arg.required) {
assert outputs.containsKey(arg.plainName) && outputs.get(arg.plainName) != null :
"Error in module '${key}' id '${id}': required output argument '${arg.plainName}' is missing"
}
}
}
}
154 changes: 154 additions & 0 deletions src/main/resources/io/viash/runners/nextflow/states/publishFiles.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
def publishFiles(Map args) {
def key_ = args.get("key")

assert key_ != null : "publishFiles: key must be specified"

workflow publishFilesWf {
take: input_ch
main:
input_ch
| map { tup ->
def id_ = tup[0]
def state_ = tup[1]

// the input files and the target output filenames
def inputoutputFilenames_ = collectInputOutputPaths(state_, id_ + "." + key_).transpose()
def inputFiles_ = inputoutputFilenames_[0]
def outputFilenames_ = inputoutputFilenames_[1]

[id_, inputFiles_, outputFilenames_]
}
| publishFilesProc
emit: input_ch
}
return publishFilesWf
}

process publishFilesProc {
// todo: check publishpath?
publishDir path: "${getPublishDir()}/", mode: "copy"
tag "$id"
input:
tuple val(id), path(inputFiles, stageAs: "_inputfile?/*"), val(outputFiles)
output:
tuple val(id), path{outputFiles}
script:
def copyCommands = [
inputFiles instanceof List ? inputFiles : [inputFiles],
outputFiles instanceof List ? outputFiles : [outputFiles]
]
.transpose()
.collectMany{infile, outfile ->
if (infile.toString() != outfile.toString()) {
[
"[ -d \"\$(dirname '${outfile.toString()}')\" ] || mkdir -p \"\$(dirname '${outfile.toString()}')\"",
"cp -r '${infile.toString()}' '${outfile.toString()}'"
]
} else {
// no need to copy if infile is the same as outfile
[]
}
}
"""
echo "Copying output files to destination folder"
${copyCommands.join("\n ")}
"""
}


// this assumes that the state contains no other values other than those specified in the config
def publishFilesByConfig(Map args) {
def config = args.get("config")
assert config != null : "publishFilesByConfig: config must be specified"

def key_ = args.get("key", config.name)
assert key_ != null : "publishFilesByConfig: key must be specified"

workflow publishFilesSimpleWf {
take: input_ch
main:
input_ch
| map { tup ->
def id_ = tup[0]
def state_ = tup[1] // e.g. [output: new File("myoutput.h5ad"), k: 10]
def origState_ = tup[2] // e.g. [output: '$id.$key.foo.h5ad']


// the processed state is a list of [key, value, inputPath, outputFilename] tuples, where
// - key is a String
// - value is any object that can be serialized to a Yaml (so a String/Integer/Long/Double/Boolean, a List, a Map, or a Path)
// - inputPath is a List[Path]
// - outputFilename is a List[String]
// - (inputPath, outputFilename) are the files that will be copied from src to dest (relative to the state.yaml)
def processedState =
config.allArguments
.findAll { it.direction == "output" }
.collectMany { par ->
def plainName_ = par.plainName
// if the state does not contain the key, it's an
// optional argument for which the component did
// not generate any output OR multiple channels were emitted
// and the output was just not added to using the channel
// that is now being parsed
if (!state_.containsKey(plainName_)) {
return []
}
def value = state_[plainName_]
// if the parameter is not a file, it should be stored
// in the state as-is, but is not something that needs
// to be copied from the source path to the dest path
if (par.type != "file") {
return [[inputPath: [], outputFilename: []]]
}
// if the orig state does not contain this filename,
// it's an optional argument for which the user specified
// that it should not be returned as a state
if (!origState_.containsKey(plainName_)) {
return []
}
def filenameTemplate = origState_[plainName_]
// if the pararameter is multiple: true, fetch the template
if (par.multiple && filenameTemplate instanceof List) {
filenameTemplate = filenameTemplate[0]
}
// instantiate the template
def filename = filenameTemplate
.replaceAll('\\$id', id_)
.replaceAll('\\$\\{id\\}', id_)
.replaceAll('\\$key', key_)
.replaceAll('\\$\\{key\\}', key_)
if (par.multiple) {
// if the parameter is multiple: true, the filename
// should contain a wildcard '*' that is replaced with
// the index of the file
assert filename.contains("*") : "Module '${key_}' id '${id_}': Multiple output files specified, but no wildcard '*' in the filename: ${filename}"
def outputPerFile = value.withIndex().collect{ val, ix ->
def filename_ix = filename.replace("*", ix.toString())
def inputPath = val instanceof File ? val.toPath() : val
[inputPath: inputPath, outputFilename: filename_ix]
}
def transposedOutputs = ["inputPath", "outputFilename"].collectEntries{ key ->
[key, outputPerFile.collect{dic -> dic[key]}]
}
return [[key: plainName_] + transposedOutputs]
} else {
def value_ = java.nio.file.Paths.get(filename)
def inputPath = value instanceof File ? value.toPath() : value
return [[inputPath: [inputPath], outputFilename: [filename]]]
}
}

def inputPaths = processedState.collectMany{it.inputPath}
def outputFilenames = processedState.collectMany{it.outputFilename}


[id_, inputPaths, outputFilenames]
}
| publishFilesProc
emit: input_ch
}
return publishFilesSimpleWf
}



Loading
Loading