Code Integration: Operations and Scenarios
R Convenience Functions
...
codeObj <- Code(name, parent, codeRepo)
parameters
name
localFolder: folder or file on the local file system
codeRepo short, easily remembered 'nickname' of code repository system. If omitted, user's default is used.
TODO: Do we need additional repository parameters (e.g. a folder within the repository) or can those be made part of the codeRepo object?
side effects
Register folder with code repository, if not already registered.
Commit code.
Create metadata in Synapse, if not already created.
TODO: What if not all steps are successful?
returns
ID of the object created in Synapse
Note: Code version is not recorded in the code metadata.
saveAndRun(localFolder, codeRepo)
parameters
localFolder: folder or file on the local file system
codeRepo short, easily remembered 'nickname' of code repository system. If omitted, user's default is used.
side effects
Register folder with code repository, if not already registered.
Commit code, retaining the version information.
Set a global "code.version" variable to the current version.
Create metadata in Synapse, if not already created.
"Source" code into R session.
Call "run()".
TODO: Check if code has changed before committing, to avoid making new version each time code is run.
returns
ID of the object created in Synapse
Note: Code version is not recorded in the code metadata.
loadCode(id, localFolder)
parameters
id: ID of the object in Synapse
localFolder: location for local copy of code. If omitted, then a default location is used.
side effects
Check out code from code repository, if not already checked out. Otherwise, updates local copy from code repository.
"Source" code into R session.
returns
location of local copy of code
TODO: What if not all steps are successful?
deleteCode(id)
parameters
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.
Creates metadata in Synapse, including code version.
returns
nothing
loadEntity(codeId, localPath, repoSync=F)
parameters
side effects
returns
deleteEntity(codeId)
parameters
codeId: ID of the object in Synapse
side effects
Delete metadata from Synapse.
Delete from the code repository. Delete metadata from Synapse.[Alt: Print out delete command that user should execute.]
returns
Nothing.
TODO: What if not all steps are successful?
TODO: Should we delete from the local disk? From the R session?
...