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

124 copy to foreign #126

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0f743ad
fix Makefile
dimaryaz Jul 20, 2023
6969137
WIP: Use quiltcore to install packages
dimaryaz Jul 20, 2023
725802c
Replace push with quiltcore
dimaryaz Aug 23, 2023
f68b84a
Use a maven repo at s3://quilt-dima
dimaryaz Aug 23, 2023
00c1e08
fix Makefile
dimaryaz Jul 20, 2023
46716ae
WIP: Use quiltcore to install packages
dimaryaz Jul 20, 2023
26c82e8
Replace push with quiltcore
dimaryaz Aug 23, 2023
97ea35c
Use a maven repo at s3://quilt-dima
dimaryaz Aug 23, 2023
37370b0
Merge branch 'quiltcore-java-demo' of https://github.com/quiltdata/nf…
drernie Sep 4, 2023
c0f2961
v0.5 w/o Python
drernie Sep 4, 2023
506d266
Merge branch 'main' into quiltcore-java-preview
drernie Sep 4, 2023
04f7635
stop pre-installing packages
drernie Sep 4, 2023
062e222
Bump quiltcore to 0.0.2
dimaryaz Sep 4, 2023
ab4b16a
packageManifest()
drernie Sep 4, 2023
b499298
Merge branch 'quiltcore-java-demo' of https://github.com/quiltdata/nf…
drernie Sep 4, 2023
d93a6a3
Merge branch 'quiltcore-java-demo' into quiltcore-java-preview
drernie Sep 4, 2023
6847c15
manifest.getEntries
drernie Sep 4, 2023
0abe9d3
install just before read
drernie Sep 4, 2023
20a053d
only install if needed
drernie Sep 4, 2023
91f53db
GitHub-Testing-QuiltCore
drernie Sep 4, 2023
b5e72f1
id-token
drernie Sep 4, 2023
d26b4b2
GitHub-Testing-NF-Quilt
drernie Sep 4, 2023
67b9cc2
role/github
drernie Sep 5, 2023
85ff1bc
manual lint
drernie Sep 5, 2023
f166844
install before readAttributes
drernie Sep 5, 2023
c07fafb
pkg-test fail
drernie Sep 5, 2023
c4b3018
Update QuiltPackageTest.groovy
drernie Sep 7, 2023
db6b12a
error.print stack trace
drernie Sep 8, 2023
51eb557
FileSystemTransferAware
drernie Sep 8, 2023
3770b5d
Files.copy(tempFile, installedFile)
drernie Sep 10, 2023
9259c77
pass pkg-test
drernie Sep 11, 2023
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
61 changes: 61 additions & 0 deletions .github/workflows/pkg-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test

on:
# Trigger at every push. Action will also be visible from Pull Requests to master
push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
pull_request:
branches: [master]

permissions: read-all

jobs:
build:
name: Test
permissions:
contents: read
id-token: write
issues: write
pull-requests: write

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java_version: [19]
runs-on: ${{ matrix.os }}

steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::712023778557:role/GitHub-Testing-NF-Quilt
aws-region: us-east-1

- name: Setup Java ${{matrix.java_version}}
uses: actions/setup-java@v3
with:
java-version: ${{matrix.java_version}}
distribution: 'temurin'
architecture: x64
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run Package Tests
run: make pkg-test

- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: nf-quilt-pkg-test
path: |
/home/runner/work/nf-quilt/nf-quilt/plugins/nf-quilt/build/reports/tests/test/
13 changes: 6 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
build:
name: Test
permissions:
# contents: read
# id-token: write
contents: read
id-token: write
issues: write
pull-requests: write

Expand All @@ -32,12 +32,11 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Install Quilt3
uses: actions/setup-python@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
python-version: '3.10'
- run: python -m pip install quilt3
- run: which quilt3
role-to-assume: arn:aws:iam::712023778557:role/GitHub-Testing-NF-Quilt
aws-region: us-east-1

- name: Setup Java ${{matrix.java_version}}
uses: actions/setup-java@v3
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [0.5.0] 2023-09-04+

- Switch to quiltcore-java [NOTE: this pre-release does NOT check workflows]
- Do not pre-install packages (only install before write)

## [0.4.5] 2023-08-23

- fix metadata in README.md
Expand Down
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ WRITE_BUCKET ?= quilt-example
FRAGMENT ?= &path=.
NF_DIR ?= ../nextflow
PID ?= $$$$
PIP ?= python -m pip
PIPELINE ?= sarek
QUERY ?= ?Name=$(USER)&Owner=Kevin+Moore&Date=2023-03-07&Type=CRISPR&Notebook+URL=http%3A%2F%2Fexample.com
TEST_URI ?= quilt+s3://$(WRITE_BUCKET)$(QUERY)\#package=test/hurdat$(FRAGMENT)
QUILT_URI ?= quilt+s3://$(WRITE_BUCKET)\#package=$(PROJECT)/$(PIPELINE)
PIP ?= pip3
QUILT3 ?= /usr/local/bin/quilt3
REPORT ?= ./plugins/$(PROJECT)/build/reports/tests/test/index.html

verify: #compile
Expand All @@ -37,11 +34,7 @@ nextflow:
if [ ! -d "$(NF_DIR)" ]; then git clone https://github.com/nextflow-io/nextflow.git "$(NF_DIR)"; fi
pushd "$(NF_DIR)"; git checkout && make compile && git restore .; popd

install-python:
if [ ! -x "$(QUILT3)" ]; then $(PIP) install quilt3 ; fi
which quilt3

compile-all: install-python nextflow compile
compile-all: nextflow compile

check:
./gradlew check --warning-mode all
Expand Down Expand Up @@ -90,19 +83,17 @@ deps:

deps-all:
./gradlew -q dependencyInsight
# ./gradlew -q ${mm}dependencies --configuration ${CONFIG} --dependency ${module}

#
# Refresh SNAPSHOTs dependencies
#

refresh:
./gradlew --refresh-dependencies dependencies

#
# Run all tests or selected ones
#
#test:
# ./gradlew ${mm}test

test-class:
./gradlew ${mm}test --tests ${class}
Expand All @@ -112,6 +103,7 @@ fast:

#
# Upload JAR artifacts to Maven Central
#

publish:
echo "Ensure you have set 'github_organization=<owner>' in gradle.properties"
Expand Down
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,15 @@ NextFlow plugin for reading and writing Quilt packages as a FileSystem
developed by [Quilt Data](https://quiltdata.com/) that enables you read and write directly
to Quilt packages using `quilt+s3` URIs wherever your NextFlow pipeline currently use `s3` URIs.

Inspired by the original [`nf-quilt`](https://github.com/nextflow-io/nf-quilt) plugin (v0.2.0) developed by Seqera labs
Inspired by the original [`nf-quilt`](https://github.com/nextflow-io/nf-quilt) plugin (v0.2.0) developed by Seqera labs.

## I. Using the nf-quilt plugin in Production

This plugin allows your existing pipelines, without modification,
to read and write versioned Quilt packages stored on Amazon S3.

Use the following four steps to configure NextFlow Tower or your command-line environment.

1. Install the `quilt3` command-line tool

This is distributed as an open source Python package you can install using `pip3`,
and must be available in the PATH used by `nextflow`.

```bash
yum install python3-pip -y
yum install git -y
pip3 install quilt3
which quilt3
```

The above instructions use the 'yum' package manager,
which NextFlow Tower uses in the "Pre-run script"
when you edit the Pipeline settings from the Launchpad.

If you are running from the command-line, you may need to use your own package manager
(or just skip those lines if you already have Python and Git).
Use the following three steps to configure NextFlow Tower or your command-line environment.
[Note: versions 0.5.0 and later no longer require the `quilt3` Python client.]

1. Enable the `nf-quilt` plugin

Expand Down Expand Up @@ -93,8 +75,8 @@ From the command-line, do, e.g.:

```bash
# export NXF_VER=23.04.3
export NXF_PLUGINS_TEST_REPOSITORY=https://github.com/quiltdata/nf-quilt/releases/download/0.4.5/nf-quilt-0.4.5-meta.json
nextflow run main.nf -plugins nf-quilt@0.4.5
export NXF_PLUGINS_TEST_REPOSITORY=https://github.com/quiltdata/nf-quilt/releases/download/0.5.0/nf-quilt-0.5.0-meta.json
nextflow run main.nf -plugins nf-quilt@0.5.0
```

For Tower, you can use the "Pre-run script" to set the environment variables.
Expand Down Expand Up @@ -183,13 +165,6 @@ git clone https://github.com/quiltdata/nf-quilt.git
cd ./nf-quilt
```

You also need to use Python to install the `quilt3` command-line tool used by `nf-quilt`:

```bash
pip install quilt3
which quilt3
```

### Unit Testing

You can compile run unit tests with:
Expand Down
1 change: 1 addition & 0 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ subprojects {
task copyPluginLibs(type: Sync) {
from configurations.runtimeClasspath
into 'build/target/libs'
duplicatesStrategy 'exclude'
}

/*
Expand Down
4 changes: 4 additions & 0 deletions plugins/nf-quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ repositories {
maven { url = 'https://jitpack.io' }
maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/releases' }
maven { url = 'https://s3-eu-west-1.amazonaws.com/maven.seqera.io/snapshots' }
maven { url = 'https://quilt-dima.s3.amazonaws.com/maven/releases' }
}

configurations {
Expand All @@ -59,6 +60,9 @@ ext{
}

dependencies {
// quiltcore
implementation 'com.quiltdata.quiltcore:quiltcore:0.0.2'

// This dependency is exported to consumers, that is to say found on their compile classpath.
compileOnly "io.nextflow:nextflow:$nextflowVersion"
compileOnly 'org.slf4j:slf4j-api:2.0.9'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class QuiltObserver implements TraceObserver {
params.each { k, value ->
String uri = "$value"
if (uri.startsWith(QuiltParser.SCHEME)) {
log.debug("checkParams.uri[$k]: $uri")
QuiltPath path = QuiltPathFactory.parse(uri)
checkPath(path)
}
Expand Down
14 changes: 10 additions & 4 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ ${meta['workflow']['stats']['processes']}
static void writeString(String text, QuiltPackage pkg, String filename) {
String dir = pkg.packageDest()
Path path = Paths.get(dir, filename.split('/') as String[])
File parent = path.getParent().toFile()
if (parent != null && !parent.exists() && !parent.mkdirs()) {
throw new IllegalStateException("Couldn't create dir: " + parent);
}

try {
Files.write(path, text.bytes)
}
catch (Exception e) {
log.error("writeString: cannot write `$text` to `$path` for `${pkg}`")
log.error("writeString[${e.getMessage()}]: fail write `$path` for `${pkg}`")
e.printStackTrace()
}
}

Expand Down Expand Up @@ -230,9 +236,9 @@ ${meta['workflow']['stats']['processes']}
return template.toString()
}

List<Path> match(String glob) throws IOException {
String dir = pkg.packageDest()
Path folder = Paths.get(dir)
List<Path> match(String glob, boolean shouldInstall = false) throws IOException {
log.debug("QuiltProduct.match[$shouldInstall]: $glob")
Path folder = shouldInstall ? pkg.install() : pkg.packageDest()
FileSystem fs = FileSystems.getDefault()
PathMatcher pathMatcher = fs.getPathMatcher("glob:${glob}")
List<Path> matches = []
Expand Down
Loading