Skip to content

Instantly share code, notes, and snippets.

@mekhami
Created February 28, 2018 18:12
Show Gist options
  • Save mekhami/46ba37aec84bf3645e6601e28b8eec52 to your computer and use it in GitHub Desktop.
Save mekhami/46ba37aec84bf3645e6601e28b8eec52 to your computer and use it in GitHub Desktop.
@resource_op(("sample", "update", Sample))
def add_sample_dependencies(sample, parents=None, children=None, return_dict=True,
session=None, agent=None):
"""
Add set of parent and or child dependencies to a given Sample.
"""
if parents is not None:
for p_uuid in parents:
sample = add_dependency(sample, p_uuid, label='begat', return_dict=return_dict,
session=session, agent=agent)
if children is not None:
for c_uuid in children:
sample = add_dependency(c_uuid, sample, label='begat', return_dict=return_dict,
session=session, agent=agent)
return sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment