Skip to content

Commit

Permalink
fix: nextflow_poll_period_secdonds now minutes. And better nextflow a…
Browse files Browse the repository at this point in the history
…nsible task names
  • Loading branch information
Alan Christie committed Sep 23, 2024
1 parent b854cc5 commit 6d77587
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 51 deletions.
20 changes: 13 additions & 7 deletions ansible/roles/combine/tasks/nextflow-dedup-file-type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
when:
- not combined_file.stat.exists

- name: Set nextflow command
- name: Set nextflow command (Deduplicate)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -91,27 +91,33 @@
when:
- not combined_file.stat.exists

- name: Display nextflow command
- name: Display nextflow command (Deduplicate)
debug:
var: nextflow_cmd
when:
- not combined_file.stat.exists

- name: Run nextflow (async)
- name: Display nextflow command timeout (Deduplicate)
debug:
msg: nextflow_timeout_minutes={{ nextflow_timeout_minutes }} nextflow_poll_period_minutes={{ nextflow_poll_period_minutes }}
when:
- not combined_file.stat.exists

- name: Run nextflow (Deduplicate) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async
when:
- not combined_file.stat.exists

- name: Wait for nextflow (async)
- name: Wait for nextflow (Deduplicate)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
until: nextflow_result.finished
delay: "{{ nextflow_poll_period_seconds|int }}"
retries: "{{ (nextflow_timeout_minutes|int / (nextflow_poll_period_seconds|int / 60))|int }}"
delay: "{{ nextflow_poll_period_minutes | int * 60 }}"
retries: "{{ (nextflow_timeout_minutes | int / nextflow_poll_period_minutes | int) | int }}"
when:
- not combined_file.stat.exists

Expand Down Expand Up @@ -149,7 +155,7 @@
register: compress_task
when: not file_type_file.stat.exists

- name: Add this tasy to the list of compress tasks
- name: Add this task to the list of compress tasks
set_fact:
compress_tasks: "{{ compress_tasks + [ compress_task ] }}"
when: not file_type_file.stat.exists
20 changes: 13 additions & 7 deletions ansible/roles/combine/tasks/nextflow-merge-file-type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
when:
- not combined_file.stat.exists

- name: Set nextflow command
- name: Set nextflow command (Merge)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -91,27 +91,33 @@
when:
- not combined_file.stat.exists

- name: Display nextflow command
- name: Display nextflow command (Merge)
debug:
var: nextflow_cmd
when:
- not combined_file.stat.exists

- name: Run nextflow (async)
- name: Display nextflow command timeout (Merge)
debug:
msg: nextflow_timeout_minutes={{ nextflow_timeout_minutes }} nextflow_poll_period_minutes={{ nextflow_poll_period_minutes }}
when:
- not combined_file.stat.exists

- name: Run nextflow (Merge) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async
when:
- not combined_file.stat.exists

- name: Wait for nextflow (async)
- name: Wait for nextflow (Merge)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
until: nextflow_result.finished
delay: "{{ nextflow_poll_period_seconds|int }}"
retries: "{{ (nextflow_timeout_minutes|int / (nextflow_poll_period_seconds|int / 60))|int }}"
delay: "{{ nextflow_poll_period_minutes | int * 60 }}"
retries: "{{ (nextflow_timeout_minutes | int / nextflow_poll_period_minutes | int) | int }}"
when:
- not combined_file.stat.exists

Expand Down Expand Up @@ -149,7 +155,7 @@
register: compress_task
when: not file_type_file.stat.exists

- name: Add this tasy to the list of compress tasks
- name: Add this task to the list of compress tasks
set_fact:
compress_tasks: "{{ compress_tasks + [ compress_task ] }}"
when: not file_type_file.stat.exists
2 changes: 1 addition & 1 deletion ansible/roles/combine/vars/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ shatterfile_large_threshold_kb: 1048576
# and poll period for the (asynchronous) Nextflow process
# Timeouts (minutes): 1440 (24 hours)
nextflow_timeout_minutes: 1440
nextflow_poll_period_seconds: 30
nextflow_poll_period_minutes: 1

compress_timeout_minutes: 1440
compress_poll_period_minutes: 1
Expand Down
20 changes: 8 additions & 12 deletions ansible/roles/fragment/tasks/fragmentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,13 @@
that:
- nextflow_timeout_minutes | int > 0

- name: Display nextflow timeout (minutes)
debug:
var: nextflow_timeout_minutes

# Set nextflow_poll_period_minutes based on nextflow_timeout_minutes/30.
# If this is development then this defaults.
- name: Set nextflow_poll_period_minutes
set_fact:
nextflow_poll_period_minutes: "{{ (nextflow_timeout_minutes|int/60)|int }}"
when: deployment=="production"

- name: Display nextflow poll period (minutes)
debug:
var: nextflow_poll_period_minutes

- name: Log line to report
blockinfile:
marker: "<!-- {fragmentation-nextflow} ANSIBLE MANAGED BLOCK -->"
Expand All @@ -99,7 +91,7 @@
- "fragmentation.nf.j2"
- "{{ deployment }}/nextflow.config.j2"

- name: Set nextflow command
- name: Set nextflow command (Fragmentation)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -112,17 +104,21 @@
--max_hac {{ vendors[vendor].fraghac }}
--max_frag {{ vendors[vendor].fragmaxfrags }}
- name: Display nextflow command
- name: Display nextflow command (Fragmentation)
debug:
var: nextflow_cmd

- name: Run nextflow (async)
- name: Display nextflow command timeout (Fragmentation)
debug:
msg: nextflow_timeout_minutes={{ nextflow_timeout_minutes }} nextflow_poll_period_minutes={{ nextflow_poll_period_minutes }}

- name: Run nextflow (Fragmentation) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async

- name: Wait for nextflow (async)
- name: Wait for nextflow (Fragmentation)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
Expand Down
15 changes: 8 additions & 7 deletions ansible/roles/inchi/tasks/gen-isomol-inchi-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
nextflow_timeout_minutes: "{{ nextflow_timeout_calc|int }}"
when: nextflow_timeout_calc|int>nextflow_timeout_minutes

- debug:
var: nextflow_timeout_minutes

# Set nextflow_poll_period_minutes based on nextflow_timeout_minutes/30.
# If this is development then this defaults.
- name: Set nextflow_poll_period_minutes
Expand All @@ -88,7 +85,7 @@
# python -m frag.network.scripts.generate_inchi -i $FRAGPATH/fragment/$FRAGNODEFILE -o $FRAGPATH/fragment/$INCHITAB -n
#

- name: Set nextflow command
- name: Set nextflow command (Generate Isomol Inchi)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -100,17 +97,21 @@
--outputfile {{ isoinchitab }}
--chunk_size {{ inchigenchunk|int }}
- name: Display nextflow command
- name: Display nextflow command (Generate Isomol Inchi)
debug:
var: nextflow_cmd

- name: Run nextflow (async)
- name: Display nextflow command timeout (Generate Isomol Inchi)
debug:
msg: nextflow_timeout_minutes={{ nextflow_timeout_minutes }} nextflow_poll_period_minutes={{ nextflow_poll_period_minutes }}

- name: Run nextflow (Generate Isomol Inchi) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async

- name: Wait for nextflow (async)
- name: Wait for nextflow (Generate Isomol Inchi)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
Expand Down
10 changes: 5 additions & 5 deletions ansible/roles/inchi/tasks/gen-nonisomol-inchi-database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# Move the nextflow workflow and config into place (from templates)
# so they move from "<templates>/{{ deployment }}" to "{{ reppath }}/nextflow"...

- name: Translate nextflow files
- name: Translate nextflow files (Generate Inchi)
template:
src: "{{ item }}"
dest: "{{ reppath }}/nextflow/{{ item|regex_replace(deployment + '/')|regex_replace('.j2') }}"
Expand All @@ -81,7 +81,7 @@
# python -m frag.network.scripts.generate_inchi -i $FRAGPATH/fragment/$FRAGNODEFILE -o $FRAGPATH/fragment/$INCHITAB -n -s
#

- name: Set nextflow command
- name: Set nextflow command (Generate Non-Isomol Inchi)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -94,17 +94,17 @@
--chunk_size {{ inchigenchunk|int }}
--standard '{{ standard }}'
- name: Display nextflow command
- name: Display nextflow command (Generate Non-Isomol Inchi)
debug:
var: nextflow_cmd

- name: Run nextflow (async)
- name: Run nextflow (Generate Non-Isomol Inchi) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async

- name: Wait for nextflow (async)
- name: Wait for nextflow (Generate Non-Isomol Inchi)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
Expand Down
20 changes: 8 additions & 12 deletions ansible/roles/standardise/tasks/standardise-file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,13 @@
that:
- nextflow_timeout_minutes | int > 0

- name: Display nextflow timeout (minutes)
debug:
var: nextflow_timeout_minutes

# Set nextflow_poll_period_minutes based on nextflow_timeout_minutes/30.
# If this is development then this defaults.
- name: Set nextflow_poll_period_minutes
set_fact:
nextflow_poll_period_minutes: "{{ (nextflow_timeout_minutes|int/30)|int }}"
when: deployment == "production"

- name: Display nextflow poll period (minutes)
debug:
var: nextflow_poll_period_minutes

- name: Log line to report
blockinfile:
marker: "<!-- {standardise-nextflow} ANSIBLE MANAGED BLOCK -->"
Expand All @@ -118,7 +110,7 @@
- "standardizer.nf.j2"
- "{{ deployment }}/nextflow.config.j2"

- name: Set nextflow command
- name: Set nextflow command (Standardise)
set_fact:
nextflow_cmd: >-
nextflow run -c {{ reppath }}/nextflow/nextflow.config
Expand All @@ -133,17 +125,21 @@
--compound_id_field {{ standard_compound_id_field }}
--split_token {{ standsplittoken }}
- name: Display nextflow command
- name: Display nextflow command (Standardise)
debug:
var: nextflow_cmd

- name: Run nextflow (async)
- name: Display nextflow command timeout (Standardise)
debug:
msg: nextflow_timeout_minutes={{ nextflow_timeout_minutes }} nextflow_poll_period_minutes={{ nextflow_poll_period_minutes }}

- name: Run nextflow (Standardize) (async)
command: "{{ nextflow_cmd }}"
async: "{{ nextflow_timeout_minutes|int * 60 }}"
poll: 0
register: nextflow_async

- name: Wait for nextflow (async)
- name: Wait for nextflow (Standardise)
async_status:
jid: "{{ nextflow_async.ansible_job_id }}"
register: nextflow_result
Expand Down

0 comments on commit 6d77587

Please sign in to comment.