Skip to end of banner
Go to start of banner

Code Integration Scenarios

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 24 Next »

Code Integration: Operations and Scenarios

R Convenience Functions

codeObj <- Code(name, parent, codeRepo)

parameters

name

parent: a Project ID

codeRepo:  the (brief and easily remembered) name of the code repository.  If omitted, a default is used.

side effects

none

returns

new Code object

addFile(codeObj, localPath, repoPath)

parameters

codeObj

localPath: path to file or directory on machine running the R session

repoPath: path relative to repository.  If omitted then a default path is generated.

side effects

 none

returns

 nothing

storeEntity(codeObj)

parameters

 codeObj

side effects

Checks that code is committed to svn, stops if not, printing out the needed svn command(s). [Alt.:  Could do svn 'add',  'commit' on the user's behalf.]

Creates or updates metadata in Synapse, including code version.

returns

 nothing

downloadEntity(codeId, localPath)

parameters

codeId: id of metadata object in Synapse

localPath:  directory on machine which is running the R session

side effects

Checks that local files are in sync with repository and, if not, prints the svn command needed to sync. [Alt:  Could do svn 'checkout' or 'update' on user's behalf.]

 Updates the Code object (to be returned) with the current repository version.

returns

Code object

loadEntity(codeObj)

parameters

codeObj

side effects

If (codeId!=null)

  • Checks that local files are in sync with repository, and throws exception if not (printing the svn command needed to sync). [Alt:  Could do svn 'checkout' or 'update' on user's behalf.] 
  • Check that Version in R Code object is up-to-date with repository, and revises the R Code object if not. 
  • Check that the Version in Synapse Code object is up-to-date, and revises it if not.
  • Get current Step. 
  • Adds reference to Synapse Code object into Step.

'sources' code into memory

(i.e. if 'codeObj' is just a local variable, this is a utility to source a collection of files.)

returns

codeObj

deleteEntity(codeId)

parameters

codeId: ID of the object in Synapse

side effects

Delete metadata from Synapse.

Print out delete command that user should execute.[Alt: Delete from the code repository.]

returns

Nothing.

TODO: What if not all steps are successful?
TODO: Should we delete from the local disk? From the R session?

TODO: Can we defer the convenience function for loading a specific code version?

Scenarios

Discover, retrieve and load code into R session.

A user, browsing Synapse, sees a piece of code of interest (mentioned in a discussion or used in an analysis), and clicks on it.  She sees:

# Load in Synapse R Client:
entity.3733 <- loadCode(3733)

and begins by executing this in R.

(Note:  "Repo" is the code repository client.  The interaction between the repository client and server is not shown.)

Retrieve existing code, modify and save.

Develop new code, then save.

(Per Matt F., this is an important use case for data curators.)

Run code and capture provenance info.


  • No labels