|
5 | 5 | \fI.internal_call(app, context)\fR |
6 | 6 | .SH DESCRIPTION |
7 | 7 | .PP |
8 | | -This internal function executes an analysis application after validating its dependencies. It handles application execution, error reporting, and performance profiling. |
| 8 | + |
| 9 | + |
| 10 | +This internal function executes an analysis application after validating its dependencies. |
| 11 | +It handles application execution, error reporting, and performance profiling. |
9 | 12 | .PP |
10 | 13 | .SH OPTIONS |
11 | 14 | .PP |
12 | | -\fBapp\fB \fR\- . A list defining the analysis application. Must contain: - `name`: (character) Name of the application (for logging). - `call`: (function) The function to execute the application logic. - `profiler`: (list) Stores performance metrics (e.g., execution time). |
| 15 | +\fBapp\fB \fR\- . A list defining the analysis application. Must contain: |
| 16 | +- `name`: (character) Name of the application (for logging). |
| 17 | +- `call`: (function) The function to execute the application logic. |
| 18 | +- `profiler`: (list) Stores performance metrics (e.g., execution time). |
13 | 19 | .PP |
14 | 20 | .PP |
15 | | -\fBcontext\fB \fR\- . A list or environment providing runtime context, such as input data paths, environment variables, or configuration settings required by the application. |
| 21 | +\fBcontext\fB \fR\- . A list or environment providing runtime context, such as input data paths, |
| 22 | +environment variables, or configuration settings required by the application. |
16 | 23 | .PP |
17 | 24 | .SH VALUE |
18 | 25 | .PP |
19 | | -Invisibly returns `NULL`. The function primarily updates `app$profiler` with execution time metrics and may modify the `context` during execution. |
| 26 | +Invisibly returns `NULL`. The function primarily updates `app$profiler` with execution |
| 27 | +time metrics and may modify the `context` during execution. |
20 | 28 | .PP |
21 | 29 | .SH DETAILS |
22 | 30 | .PP |
23 | | -### Key Steps: 1. **Dependency Check**: Validates if required context variables and files exist via `check_dependency(app, context)`. - If dependencies are met, proceeds to execute the application. - If dependencies are missing, throws an error with detailed missing resources. 2. **Execution**: - Logs start/end timestamps if `options(verbose = TRUE)`. - Executes `app$call` with arguments `app` and `context` using `do.call()`. 3. **Error Handling**: - Aggregates missing dependencies into readable error messages. - Calls `throw_err()` to terminate the workflow and report issues. 4. **Profiling**: Records total execution time in `app$profiler$time` using `time_span()` for human-readable formatting. |
| 31 | +### Key Steps: |
| 32 | +1. **Dependency Check**: |
| 33 | +Validates if required context variables and files exist via `check_dependency(app, context)`. |
| 34 | +- If dependencies are met, proceeds to execute the application. |
| 35 | +- If dependencies are missing, throws an error with detailed missing resources. |
| 36 | +2. **Execution**: |
| 37 | +- Logs start/end timestamps if `options(verbose = TRUE)`. |
| 38 | +- Executes `app$call` with arguments `app` and `context` using `do.call()`. |
| 39 | +3. **Error Handling**: |
| 40 | +- Aggregates missing dependencies into readable error messages. |
| 41 | +- Calls `throw_err()` to terminate the workflow and report issues. |
| 42 | +4. **Profiling**: |
| 43 | +Records total execution time in `app$profiler$time` using `time_span()` for human-readable formatting. |
24 | 44 | .PP |
25 | 45 | .SH EXAMPLES |
26 | 46 | .PP |
27 | | -\dontrun{ # Define a sample application app <- list( name = "demo_analysis", call = function(argv) { print(paste("Running:", argv$app$name)) }, profiler = list() ) # Execute with context .internal_call(app, context = list()) } |
| 47 | +#\dontrun{ |
| 48 | + |
| 49 | +# Define a sample application |
| 50 | +app <- list( |
| 51 | +name = "demo_analysis", |
| 52 | +call = function(argv) { |
| 53 | +print(paste("Running:", argv$app$name)) |
| 54 | +}, |
| 55 | +profiler = list() |
| 56 | +) |
| 57 | +# Execute with context |
| 58 | +.internal_call(app, context = list()) |
| 59 | + |
| 60 | +#} |
28 | 61 | .PP |
29 | 62 | .SH FILES |
30 | 63 | .PP |
|
0 commit comments