Skip to content

Commit

Permalink
feat(Executable code nodes): Add executeCount property
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Jan 17, 2022
1 parent 4a641d2 commit 56e0902
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
10 changes: 10 additions & 0 deletions python/stencila/schema/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ class CodeExecutable(Code):
errors: Optional[Array["CodeError"]] = None
"""Errors when compiling (e.g. syntax errors) or executing the chunk."""

executeCount: Optional[Integer] = None
"""A count of the number of times that the node has been executed."""

executeDigest: Optional[String] = None
"""The `compileDigest` of the node when it was last executed."""

Expand All @@ -255,6 +258,7 @@ def __init__(
codeDependents: Optional[Array[Union["CodeChunk", "CodeExpression"]]] = None,
compileDigest: Optional[String] = None,
errors: Optional[Array["CodeError"]] = None,
executeCount: Optional[Integer] = None,
executeDigest: Optional[String] = None,
executeDuration: Optional[Number] = None,
executeEnded: Optional["Date"] = None,
Expand All @@ -281,6 +285,8 @@ def __init__(
self.compileDigest = compileDigest
if errors is not None:
self.errors = errors
if executeCount is not None:
self.executeCount = executeCount
if executeDigest is not None:
self.executeDigest = executeDigest
if executeDuration is not None:
Expand Down Expand Up @@ -325,6 +331,7 @@ def __init__(
compileDigest: Optional[String] = None,
errors: Optional[Array["CodeError"]] = None,
executeAuto: Optional["EExecuteAuto"] = None,
executeCount: Optional[Integer] = None,
executeDigest: Optional[String] = None,
executeDuration: Optional[Number] = None,
executeEnded: Optional["Date"] = None,
Expand All @@ -344,6 +351,7 @@ def __init__(
codeDependents=codeDependents,
compileDigest=compileDigest,
errors=errors,
executeCount=executeCount,
executeDigest=executeDigest,
executeDuration=executeDuration,
executeEnded=executeEnded,
Expand Down Expand Up @@ -385,6 +393,7 @@ def __init__(
codeDependents: Optional[Array[Union["CodeChunk", "CodeExpression"]]] = None,
compileDigest: Optional[String] = None,
errors: Optional[Array["CodeError"]] = None,
executeCount: Optional[Integer] = None,
executeDigest: Optional[String] = None,
executeDuration: Optional[Number] = None,
executeEnded: Optional["Date"] = None,
Expand All @@ -402,6 +411,7 @@ def __init__(
codeDependents=codeDependents,
compileDigest=compileDigest,
errors=errors,
executeCount=executeCount,
executeDigest=executeDigest,
executeDuration=executeDuration,
executeEnded=executeEnded,
Expand Down
9 changes: 9 additions & 0 deletions r/R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ CodeBlock <- function(
#' @param codeDependents The downstream dependents of the code.
#' @param compileDigest A digest of the content, semantics and dependencies of the node.
#' @param errors Errors when compiling (e.g. syntax errors) or executing the chunk.
#' @param executeCount A count of the number of times that the node has been executed.
#' @param executeDigest The `compileDigest` of the node when it was last executed.
#' @param executeDuration Duration in seconds of the last execution of the code.
#' @param executeEnded The date-time that the the last execution of the code ended.
Expand All @@ -189,6 +190,7 @@ CodeExecutable <- function(
codeDependents,
compileDigest,
errors,
executeCount,
executeDigest,
executeDuration,
executeEnded,
Expand All @@ -211,6 +213,7 @@ CodeExecutable <- function(
self[["codeDependents"]] <- check_property("CodeExecutable", "codeDependents", FALSE, missing(codeDependents), Array(Union(CodeChunk, CodeExpression)), codeDependents)
self[["compileDigest"]] <- check_property("CodeExecutable", "compileDigest", FALSE, missing(compileDigest), "character", compileDigest)
self[["errors"]] <- check_property("CodeExecutable", "errors", FALSE, missing(errors), Array(CodeError), errors)
self[["executeCount"]] <- check_property("CodeExecutable", "executeCount", FALSE, missing(executeCount), "numeric", executeCount)
self[["executeDigest"]] <- check_property("CodeExecutable", "executeDigest", FALSE, missing(executeDigest), "character", executeDigest)
self[["executeDuration"]] <- check_property("CodeExecutable", "executeDuration", FALSE, missing(executeDuration), "numeric", executeDuration)
self[["executeEnded"]] <- check_property("CodeExecutable", "executeEnded", FALSE, missing(executeEnded), Date, executeEnded)
Expand All @@ -232,6 +235,7 @@ CodeExecutable <- function(
#' @param compileDigest A digest of the content, semantics and dependencies of the node.
#' @param errors Errors when compiling (e.g. syntax errors) or executing the chunk.
#' @param executeAuto Under which circumstances the node should be automatically executed.
#' @param executeCount A count of the number of times that the node has been executed.
#' @param executeDigest The `compileDigest` of the node when it was last executed.
#' @param executeDuration Duration in seconds of the last execution of the code.
#' @param executeEnded The date-time that the the last execution of the code ended.
Expand Down Expand Up @@ -275,6 +279,7 @@ CodeChunk <- function(
compileDigest,
errors,
executeAuto,
executeCount,
executeDigest,
executeDuration,
executeEnded,
Expand All @@ -294,6 +299,7 @@ CodeChunk <- function(
codeDependents = codeDependents,
compileDigest = compileDigest,
errors = errors,
executeCount = executeCount,
executeDigest = executeDigest,
executeDuration = executeDuration,
executeEnded = executeEnded,
Expand Down Expand Up @@ -324,6 +330,7 @@ CodeChunk <- function(
#' @param codeDependents The downstream dependents of the code.
#' @param compileDigest A digest of the content, semantics and dependencies of the node.
#' @param errors Errors when compiling (e.g. syntax errors) or executing the chunk.
#' @param executeCount A count of the number of times that the node has been executed.
#' @param executeDigest The `compileDigest` of the node when it was last executed.
#' @param executeDuration Duration in seconds of the last execution of the code.
#' @param executeEnded The date-time that the the last execution of the code ended.
Expand All @@ -343,6 +350,7 @@ CodeExpression <- function(
codeDependents,
compileDigest,
errors,
executeCount,
executeDigest,
executeDuration,
executeEnded,
Expand All @@ -360,6 +368,7 @@ CodeExpression <- function(
codeDependents = codeDependents,
compileDigest = compileDigest,
errors = errors,
executeCount = executeCount,
executeDigest = executeDigest,
executeDuration = executeDuration,
executeEnded = executeEnded,
Expand Down
Loading

0 comments on commit 56e0902

Please sign in to comment.