-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from seqeralabs/dev
Dev -> Master for 0.5.0 release
- Loading branch information
Showing
15 changed files
with
262 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,61 +11,21 @@ on: | |
types: [published] | ||
|
||
jobs: | ||
EditorConfig: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
|
||
- name: Install editorconfig-checker | ||
run: npm install -g editorconfig-checker | ||
|
||
- name: Run ECLint check | ||
run: editorconfig-checker -exclude README.md $(find .* -type f | grep -v '.git\|.py\|.md\|json\|yml\|yaml\|html\|css\|work\|.nextflow\|build\|nf_core.egg-info\|log.txt\|Makefile') | ||
|
||
Prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
|
||
- name: Install Prettier | ||
run: npm install -g prettier | ||
|
||
- name: Run Prettier --check | ||
run: prettier --check ${GITHUB_WORKSPACE} | ||
|
||
PythonBlack: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Check code lints with Black | ||
uses: psf/black@stable | ||
|
||
# If the above check failed, post a comment on the PR explaining the failure | ||
- name: Post PR comment | ||
if: failure() | ||
uses: mshick/add-pr-comment@v1 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | ||
with: | ||
message: | | ||
## Python linting (`black`) is failing | ||
To keep the code consistent with lots of contributors, we run automated code consistency checks. | ||
To fix this CI test, please run: | ||
* Install [`black`](https://black.readthedocs.io/en/stable/): `pip install black` | ||
* Fix formatting errors in your pipeline: `black .` | ||
Once you push these changes the test should pass, and you can hide this comment :+1: | ||
python-version: "3.12" | ||
|
||
We highly recommend setting up Black in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help! | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
|
||
Thanks again for your contribution! | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
allow-repeats: false | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files | ||
|
||
nf-core: | ||
runs-on: ubuntu-latest | ||
|
@@ -84,7 +44,7 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install nf-core | ||
pip install git+https://github.com/nf-core/[email protected] | ||
- name: Run nf-core lint | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ process { | |
saveAs: { filename -> filename.equals('versions.yml') ? null : filename } | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,65 @@ | ||
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2;transitive=false') | ||
import wslite.rest.RESTClient | ||
import groovy.json.JsonSlurper | ||
import nextflow.exception.ProcessException | ||
import groovy.json.JsonBuilder | ||
|
||
// Set system properties for custom Java trustStore | ||
def setTrustStore(trustStorePath, trustStorePassword) { | ||
System.setProperty("javax.net.ssl.trustStore", trustStorePath) | ||
if (trustStorePassword) { | ||
System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword) | ||
Long getWorkspaceId(orgName, workspaceName, api_endpoint, authHeader) { | ||
Map response | ||
try { | ||
def responseString = new URL("${api_endpoint}/orgs").getText(requestProperties: authHeader) | ||
response = new groovy.json.JsonSlurper().parseText(responseString) | ||
} catch (Exception e) { | ||
log.warn "Could not fetch organization ${orgName} from API endpoint ${api_endpoint}" | ||
throw new nextflow.exception.ProcessException("Failed to get organization details for ${orgName} in workspace ${workspaceName}", e) | ||
} | ||
} | ||
|
||
Long getWorkspaceId(orgName, workspaceName, client, authHeader) { | ||
def orgResponse = client.get(path: '/orgs', headers: authHeader) | ||
if (orgResponse.statusCode == 200) { | ||
def orgMap = orgResponse.json?.organizations.collectEntries { org -> [org.name, org.orgId] } | ||
def orgId = orgMap.get(orgName) | ||
if(!orgId) log.warn "Could not find organization '${orgName}'" | ||
def orgId = response | ||
?.organizations | ||
?.collectEntries { org -> [org.name, org.orgId] } | ||
?.get(orgName) | ||
if(!orgId) log.warn "Could not find organization '${orgName}'" | ||
|
||
// GET the workspaces in this org | ||
def workspaceReponse = client.get(path: "/orgs/${orgId}/workspaces", headers: authHeader) | ||
if (workspaceReponse.statusCode == 200) { | ||
def workspaceMap = workspaceReponse.json?.workspaces.collectEntries { ws -> [ws.name, ws.id]} | ||
return workspaceMap?.get(workspaceName) | ||
} else { | ||
log.error "Failed to fetch workspaces for orgId: ${orgId}, statusCode: ${workspaceResponse.statusCode}" | ||
} | ||
try { | ||
def workspaceReponse = new URL("${api_endpoint}/orgs/${orgId}/workspaces").getText(requestProperties: authHeader) | ||
def workspaceMap = new groovy.json.JsonSlurper() | ||
.parseText(workspaceReponse) | ||
?.workspaces | ||
?.collectEntries { ws -> [ws.name, ws.id]} | ||
return workspaceMap?.get(workspaceName) | ||
} catch (Exception e) { | ||
log.error "Failed to fetch workspaces for orgId: ${orgId}" | ||
return null | ||
} | ||
return null | ||
} | ||
|
||
Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) { | ||
def runId = meta.id | ||
def (orgName, workspaceName) = meta.workspace.tokenize("/") | ||
|
||
if (trustStorePath) { | ||
log.info "Setting custom truststore: ${trustStorePath}" | ||
setTrustStore(trustStorePath, trustStorePassword) | ||
} | ||
|
||
def client = new RESTClient(api_endpoint) | ||
def token = System.getenv("TOWER_ACCESS_TOKEN") | ||
def authHeader = ["Authorization": "Bearer ${token}"] | ||
def workspaceId = getWorkspaceId(orgName, workspaceName, api_endpoint, authHeader) | ||
def endpointUrl = "${api_endpoint}/workflow/${runId}?workspaceId=${workspaceId}" | ||
if(!workspaceId) { | ||
log.error "Failed to get workspaceId for ${orgName}/${workspaceName}" | ||
return [:] | ||
} | ||
|
||
try { | ||
def workspaceId = getWorkspaceId(orgName, workspaceName, client, authHeader) | ||
if (workspaceId) { | ||
def workflowResponse = client.get(path: "/workflow/${runId}", query: ["workspaceId":workspaceId], headers: authHeader) | ||
if (workflowResponse.statusCode == 200) { | ||
def metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName") | ||
def configText = new JsonBuilder(workflowResponse?.json?.workflow?.configText) | ||
def pattern = /fusion\s*\{\\n\s*enabled\s*=\s*true/ | ||
def matcher = configText.toPrettyString() =~ pattern | ||
metaMap.fusion = matcher.find() | ||
def workflowResponseString = new URL(endpointUrl).getText(requestProperties: authHeader) | ||
def workflowResponse = new groovy.json.JsonSlurper().parseText(workflowResponseString) | ||
def metaMap = workflowResponse | ||
?.workflow | ||
?.subMap("runName", "workDir", "projectName") | ||
def configText = new groovy.json.JsonBuilder(workflowResponse?.workflow?.configText) | ||
def pattern = /fusion\s*\{\\n\s*enabled\s*=\s*true/ | ||
def matcher = configText.toPrettyString() =~ pattern | ||
metaMap.fusion = matcher.find() | ||
|
||
return metaMap ?: [:] | ||
} | ||
} | ||
} catch (wslite.rest.RESTClientException ex) { | ||
log.warn """ | ||
Could not get workflow details for workflow ${runId} in workspace ${meta.workspace}: | ||
↳ Status code ${ex.response?.statusCode} returned from request to ${ex.request?.url} (authentication headers excluded) | ||
""".stripIndent() | ||
log.error "Exception: ${ex.message}", ex | ||
throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) | ||
return metaMap ?: [:] | ||
} catch (Exception ex) { | ||
log.warn """ | ||
An error occurred while getting workflow details for workflow ${runId} in workspace ${meta.workspace}: | ||
↳ ${ex.message} | ||
Could not get workflow details for workflow ${runId} in workspace ${meta.workspace}: | ||
↳ From request to ${endpointUrl} | ||
""".stripIndent() | ||
log.error "Exception: ${ex.message}", ex | ||
throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) | ||
|
||
throw new nextflow.exception.ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) | ||
} | ||
return [:] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
includeConfig '../../modules/local/seqera_runs_dump/nextflow.config' | ||
includeConfig '../../modules/local/plot_run_gantt/nextflow.config' | ||
includeConfig '../../modules/nf-core/multiqc/nextflow.config' | ||
includeConfig '../../modules/nf-core/multiqc/nextflow.config' |