|
1 | | -# Azure plugin for Nextflow |
| 1 | +# Nextflow plugin for Microsoft Azure |
2 | 2 |
|
3 | | -This plugin implements the support for Azure Blob storage as file system |
4 | | -provider (via JSR203 interface) and Azure Batch executor for Nextflow. |
| 3 | +This plugin provides support for Azure Blob Storage as a file system and Azure Batch as a compute executor for Nextflow pipelines. |
5 | 4 |
|
6 | | -## Development |
| 5 | +## Get Started |
7 | 6 |
|
8 | | -Build Nextflow as usual: |
| 7 | +To use this plugin, add it to your `nextflow.config`: |
9 | 8 |
|
10 | | -```bash |
11 | | -make compile |
| 9 | +```groovy |
| 10 | +plugins { |
| 11 | + id 'nf-azure' |
| 12 | +} |
12 | 13 | ``` |
13 | 14 |
|
14 | | -Use the following Nextflow configuration: |
| 15 | +Configure your Azure credentials and services: |
| 16 | + |
| 17 | +```groovy |
| 18 | +azure { |
| 19 | + storage { |
| 20 | + accountName = '<YOUR STORAGE ACCOUNT NAME>' |
| 21 | + accountKey = '<YOUR STORAGE ACCOUNT KEY>' |
| 22 | + } |
| 23 | +
|
| 24 | + batch { |
| 25 | + endpoint = 'https://<YOUR BATCH ACCOUNT NAME>.<REGION>.batch.azure.com' |
| 26 | + accountName = '<YOUR BATCH ACCOUNT NAME>' |
| 27 | + accountKey = '<YOUR BATCH ACCOUNT KEY>' |
| 28 | + } |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +Set the executor and work directory: |
| 33 | + |
| 34 | +```groovy |
| 35 | +process.executor = 'azurebatch' |
| 36 | +workDir = 'az://<YOUR CONTAINER>/work' |
| 37 | +``` |
| 38 | + |
| 39 | +## Examples |
| 40 | + |
| 41 | +### Basic Azure Batch Configuration |
15 | 42 |
|
16 | 43 | ```groovy |
17 | 44 | plugins { |
18 | | - id 'nf-azure' |
| 45 | + id 'nf-azure' |
19 | 46 | } |
20 | 47 |
|
21 | 48 | azure { |
22 | | - storage { |
23 | | - accountKey = "<YOUR STORAGE ACCOUNT KEY>" |
24 | | - accountName = "<YOUR STORAGE ACCOUNT KEY>" |
25 | | - } |
26 | | -
|
27 | | - batch { |
28 | | - endpoint = 'https://<YOUR BATCH ACCOUNT NAME>.westeurope.batch.azure.com' |
29 | | - accountName = '<YOUR BATCH ACCOUNT NAME>' |
30 | | - accountKey = '<YOUR BATCH ACCOUNT KEY>' |
31 | | - } |
| 49 | + storage { |
| 50 | + accountName = 'mystorageaccount' |
| 51 | + accountKey = System.getenv('AZURE_STORAGE_KEY') |
| 52 | + } |
| 53 | +
|
| 54 | + batch { |
| 55 | + endpoint = 'https://mybatchaccount.westeurope.batch.azure.com' |
| 56 | + accountName = 'mybatchaccount' |
| 57 | + accountKey = System.getenv('AZURE_BATCH_KEY') |
| 58 | + autoPoolMode = true |
| 59 | + deletePoolsOnCompletion = true |
| 60 | + } |
32 | 61 | } |
33 | 62 |
|
34 | 63 | process.executor = 'azurebatch' |
35 | | -workDir = 'az://<YOUR DATA CONTAINER>/work' |
| 64 | +workDir = 'az://mycontainer/work' |
36 | 65 | ``` |
37 | 66 |
|
38 | | -Then test the local build as usual: |
| 67 | +### Using Managed Identity |
39 | 68 |
|
40 | | -```bash |
41 | | -./launch.sh run -c nextflow.config rnaseq-nf |
| 69 | +```groovy |
| 70 | +azure { |
| 71 | + managedIdentity { |
| 72 | + clientId = '<YOUR MANAGED IDENTITY CLIENT ID>' |
| 73 | + } |
| 74 | +} |
42 | 75 | ``` |
43 | 76 |
|
44 | | -## Todo |
45 | | - |
46 | | -* Currently, the Blob storage service uses NettyHttpClient and Batch service |
47 | | - uses OkHttp client, duplicating the number of required libraries. In principle |
48 | | - the Blob service can use OkHttp, adding the following deps, however using that |
49 | | - Nextflow hangs during the shutdown, apparently because the connection pool used |
50 | | - by the blob service is not closed timely. |
51 | | - |
52 | | - ```groovy |
53 | | - compile('com.azure:azure-storage-blob:12.9.0') { |
54 | | - exclude group: 'org.slf4j', module: 'slf4j-api' |
55 | | - exclude group: 'com.azure', module: 'azure-core-http-netty' |
56 | | - } |
57 | | - compile('com.azure:azure-core-http-okhttp:1.3.3') { |
58 | | - exclude group: 'org.slf4j', module: 'slf4j-api' |
59 | | - } |
60 | | - ``` |
61 | | - |
62 | | -* Remove invalid directory from .command.run PATH for project having `bin/` folder |
63 | | -* Add the configuration for the region |
64 | | -* Make the backend endpoint optional |
65 | | - |
66 | | -### Additional Resources |
67 | | - |
68 | | -* https://github.com/Azure/azure-sdk-for-java/wiki |
69 | | -* https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-blob-nio |
70 | | -* https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-blob-nio/src/samples/java/com/azure/storage/blob/nio/ReadmeSamples.java |
| 77 | +## Resources |
| 78 | + |
| 79 | +- [Azure Batch Executor Documentation](https://nextflow.io/docs/latest/azure.html) |
| 80 | + |
| 81 | +## License |
| 82 | + |
| 83 | +[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
0 commit comments