Sequences, PID loops, logging and export sets all have to be started to do anything. They often need to be stopped as well. You can do this manually with a page component, automatically when the document loads by setting Auto-Start, or programmatically with this group of begin/end functions. All of these have equivalent start() / stop() functions which do the same thing. So sequence.mySequence.begin() is the same as sequence.mySequence.start().
These two statements will start or stop a sequence (in this case, one named MySequence):
sequence.MySequence.begin()
With begin(), The sequence is started in its own thread. This is different from a sequence function call which runs the sequence within the current thread. Because begin() starts the sequence in its own thread, the statement will return immediately, and the newly started sequence will run concurrently with the calling sequence. If the sequence is already running, the statement is ignored and the sequence continues running. It is not restarted.
sequence.MySequence.end()
This will stop a running sequence. If the sequence is not running the statement is ignored. The base sequence should be referenced in the statement. In other words, if sequence A is running and it happens to call sequence B as a function (not using begin()) and you want to stop it, you should do sequence.A.end() and not sequence.B.end(). Unless sequence B happens to be also running on its own in a separate thread, sequence.B.end() won't do anything.
Note that it is better to use the return statement inside a sequence to get it to end than to use sequence.mySequence.end() otherwise you can't copy your code or rename the sequence without changing these lines.
These two statements will start or stop a PID loop. PID loops also run in separate threads inside of DAQFactory and therefore run concurrently with sequences. These statements will return immediately.
PID.MyPIDLoop.begin()
PID.MyPIDLoop.end()
These two statements will start or stop a logging set. Like PID loops and most sequences, logging sets run in their own thread concurrently with sequences and PID loops. These statements will return immediately. Note that logging sets have a little time latency built in so additional data may be logged after the logging set is complete. Logging sets are really designed to be left running. If you want to conditionally log data, use an export set instead to log a single line of data, and then trigger the export set every time you want to log a line of data.
logging.MyLoggingSet.begin()
logging.MyLoggingSet.end()
These two statements will start or stop an export set. Like PID loops and most sequences, export sets run in their own thread concurrently with sequences and PID loops. These statements will return immediately. Note that most Export sets run quickly and then stop on their own, so you may not see any indication that it actually ran in the Workspace.
export.MyExportSet.begin()
export.MyExportSet.end()