text stringlengths 0 828 |
|---|
- topic: the topic on which to send the message. Defaults to ''. |
"""""" |
if message_type == MULTIPART: |
raise Exception(""Unsupported request type"") |
super(Publisher,self).send(message,message_type,topic)" |
692,"def load(self, cls, run_id): |
"""""" |
Load a workflow |
cls - workflow class (to get __name__ from) |
run_id - id given to the specific run |
"""""" |
id_code = self.generate_load_identifier(cls, run_id) |
inst = self.store.load(id_code) |
return inst" |
693,"def save(self, obj, run_id): |
"""""" |
Save a workflow |
obj - instance of a workflow to save |
run_id - unique id to give the run |
"""""" |
id_code = self.generate_save_identifier(obj, run_id) |
self.store.save(obj, id_code)" |
694,"def setup_tasks(self, tasks): |
"""""" |
Find task classes from category.namespace.name strings |
tasks - list of strings |
"""""" |
task_classes = [] |
for task in tasks: |
category, namespace, name = task.split(""."") |
try: |
cls = find_in_registry(category=category, namespace=namespace, name=name)[0] |
except TypeError: |
log.error(""Could not find the task with category.namespace.name {0}"".format(task)) |
raise TypeError |
task_classes.append(cls) |
self.tasks = task_classes" |
695,"def initialize_workflow(self, workflow): |
"""""" |
Create a workflow |
workflow - a workflow class |
"""""" |
self.workflow = workflow() |
self.workflow.tasks = self.tasks |
self.workflow.input_file = self.input_file |
self.workflow.input_format = self.input_format |
self.workflow.target_file = self.target_file |
self.workflow.target_format = self.target_format |
self.workflow.run_id = self.run_id |
self.workflow.setup()" |
696,"def reformat_filepath(self, config_file, filename): |
"""""" |
Convert relative paths in config file to absolute |
"""""" |
if not filename.startswith(""/""): |
filename = self.config_file_format.format(config_file, filename) |
return filename" |
697,"def item_lister(command, _connection, page_size, page_number, sort_by, |
sort_order, item_class, result_set, **kwargs): |
"""""" |
A generator function for listing Video and Playlist objects. |
"""""" |
# pylint: disable=R0913 |
page = page_number |
while True: |
item_collection = _connection.get_list(command, |
page_size=page_size, |
page_number=page, |
sort_by=sort_by, |
sort_order=sort_order, |
item_class=item_class, |
**kwargs) |
result_set.total_count = item_collection.total_count |
result_set.page_number = page |
for item in item_collection.items: |
yield item |
if item_collection.total_count < 0 or item_collection.page_size == 0: |
break |
if len(item_collection.items) > 0: |
page += 1 |
else: |
break" |
698,"def get_manifest(self, asset_xml): |
"""""" |
Construct and return the xml manifest to deliver along with video file. |
"""""" |
# pylint: disable=E1101 |
manifest = '<?xml version=""1.0"" encoding=""utf-8""?>' |
manifest += '<publisher-upload-manifest publisher-id=""%s"" ' % \ |
self.publisher_id |
manifest += 'preparer=""%s"" ' % self.preparer |
if self.report_success: |
manifest += 'report-success=""TRUE"">\n' |
for notify in self.notifications: |
manifest += '<notify email=""%s""/>' % notify |
if self.callback: |
manifest += '<callback entity-url=""%s""/>' % self.callback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.