Skip to contents

Get the Activity from Synapse based on the parent entity.

Usage

synGetFromParent(cls, parent, parent_version_number=NULL, synapse_client=NULL)

Arguments

cls

(Activity) The Activity class (or an existing Activity instance) to dispatch this call to.

parent

(Union[Table, File, EntityView, Dataset, str]) The parent entity this activity is associated with. The parent may also have a version_number. Gets the most recent version if version is omitted.

parent_version_number

(Optional[int]) The version number of the parent entity. When parent is a string with version (e.g., "syn123.4"), the version in the string takes precedence. When parent is an object, this parameter takes precedence over parent$version_number. Gets the most recent version if omitted.

synapse_client

(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used.

Value

The Activity object, or NULL if it does not exist.

Errors

An error is raised if the parent does not have an ID.

Examples

if (FALSE) { # \dontrun{
## Using this function
    # Get the Activity associated with the latest version of an entity
    library(synapser)
    synLogin()

    activity = Activity() |> synGetFromParent(parent = "syn123")
    print(activity$name)

    # Get the Activity associated with a specific version of an entity
    activity = Activity() |> synGetFromParent(parent = "syn123", parent_version_number = 2L)

    # Or include the version in the Synapse ID
    activity = Activity() |> synGetFromParent(parent = "syn123.2")
} # }