Skip to content

Commit 4914c64

Browse files
committed
Custom IO docs
1 parent 4ff748f commit 4914c64

File tree

3 files changed

+37
-26
lines changed

3 files changed

+37
-26
lines changed

README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ Once the run command string has been passed to the runner, nextflow.py will
144144
wait for the pipeline to complete by watching the execution directory, and then
145145
return the ``Execution`` object as normal.
146146

147+
Custom IO
148+
~~~~~~~~~
149+
150+
By default, nextflow will try to access the local filesystem when checking the
151+
output pipeline files. If you need to define alternative ways of doing this, you
152+
can create a custom ``IO`` object and pass it in as the ``io`` parameter to the
153+
``run`` method:
154+
155+
>>> execution = pipeline.run("my-pipeline.nf", io=my_custom_io)
156+
157+
This object must define the following methods:
158+
159+
* ``abspath(path)`` - Return the absolute path to a file.
160+
* ``listdir(path)`` - List the contents of a directory.
161+
* ``read(path, mode="r")`` - Read the contents of a file.
162+
* ``glob(path)`` - Glob a path.
163+
* ``ctime(path)`` - Get the creation time of a file.
164+
147165
Polling
148166
~~~~~~~
149167

docs/source/overview.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ Once the run command string has been passed to the runner, nextflow.py will
6464
wait for the pipeline to complete by watching the execution directory, and then
6565
return the :py:class:`.Execution` object as normal.
6666

67+
Custom IO
68+
~~~~~~~~~
69+
70+
By default, nextflow will try to access the local filesystem when checking the
71+
output pipeline files. If you need to define alternative ways of doing this, you
72+
can create a custom ``IO`` object and pass it in as the ``io`` parameter to the
73+
``run`` method:
74+
75+
>>> execution = pipeline.run("my-pipeline.nf", io=my_custom_io)
76+
77+
This object must define the following methods:
78+
79+
* ``abspath(path)`` - Return the absolute path to a file.
80+
* ``listdir(path)`` - List the contents of a directory.
81+
* ``read(path, mode="r")`` - Read the contents of a file.
82+
* ``glob(path)`` - Glob a path.
83+
* ``ctime(path)`` - Get the creation time of a file.
84+
6785
Polling
6886
~~~~~~~
6987

nextflow/io.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,4 @@ def get_process_ids_to_paths(process_ids, execution_path, io=None):
6060
if sub.startswith(process_id):
6161
process_ids_to_paths[process_id] = subdirectory
6262
break
63-
return process_ids_to_paths
64-
65-
66-
67-
68-
class CustomIO:
69-
70-
def abspath(path):
71-
pass
72-
73-
74-
def listdir(path):
75-
pass
76-
77-
78-
def read(path, mode="r"):
79-
pass
80-
81-
82-
def ctime(path):
83-
pass
84-
85-
86-
def glob(path):
87-
pass
88-
63+
return process_ids_to_paths

0 commit comments

Comments
 (0)