Skip to content

Commit 5b666ef

Browse files
committed
Move DROP_SOURCE_DB process to module file
1 parent ff6d806 commit 5b666ef

File tree

2 files changed

+35
-17
lines changed

2 files changed

+35
-17
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// See the NOTICE file distributed with this work for additional information
2+
// regarding copyright ownership.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
nextflow.enable.dsl=2
17+
18+
process DROP_SOURCE_DB {
19+
20+
input:
21+
tuple val(job_id), val(db_name)
22+
23+
script:
24+
println "Dropping source database: ${db_name}"
25+
26+
"""
27+
echo "Attempting to drop database ${db_name} if it exists..."
28+
29+
mysql -h $params.target_host -P $params.target_port -u $params.dba_user -p$params.dba_pwd -e "DROP DATABASE IF EXISTS ${db_name};"
30+
31+
echo "Drop operation complete."
32+
"""
33+
34+
}

nextflow/workflows/db_cleanup/main.nf

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ include { MONITOR_DB_COPY } from '../../modules/db_cleanup/monitor_db_copy.nf'
2121
include { GENERATE_SQL } from '../../modules/db_cleanup/generate_sql.nf'
2222
include { COMPRESS_FILE } from '../../modules/db_cleanup/compress_file.nf'
2323
include { CLEANUP_TMP_DB } from '../../modules/db_cleanup/cleanup_tmp_db.nf'
24+
include { DROP_SOURCE_DB } from '../../modules/db_cleanup/drop_source_db.nf'
2425

2526
// nf-schema-related modules
2627
include { validateParameters; paramsSummaryLog; samplesheetToList } from 'plugin/nf-schema'
@@ -95,23 +96,6 @@ process TAR_COMPRESSED_SQL {
9596
"""
9697
}
9798

98-
process DROP_SOURCE_DB {
99-
100-
input:
101-
tuple val(job_id), val(db_name)
102-
103-
script:
104-
"""
105-
echo "Attempting to drop database ${db_name} if it exists..."
106-
107-
mysql -h $params.target_host -P $params.target_port -u $params.dba_user -p$params.dba_pwd -e "DROP DATABASE IF EXISTS ${db_name};"
108-
109-
echo "Drop operation complete."
110-
"""
111-
112-
}
113-
114-
11599
workflow {
116100

117101
main:

0 commit comments

Comments
 (0)