Workflow Data products

Oct 17, 2010 at 11:09 PM

Hi Trident Team,

 

I have a question regards to the data product used in Trident. Let say I constructed a simple workflow querying for an object called [Car] and in my final activity I mark my Car object as its final output, is there any way for me to retrieve my Car object from trident's data product type through any programming means?  I notice there is a property in Microsoft.Research.DataLayer.DataProduct called Content as byte array was my Car object somehow serialized as byte array? Can I  deserialize it back? Thanks.

 

Cheers,

Sam

Oct 18, 2010 at 6:35 PM
Hi Sam,
 
Please find the answers to your questions below.
<<is there any way for me to retrieve my Car object from trident's data product type through any programming means>>
Yes, you can retrieve the object from dataproducts using XMLSerialization.  
Please find the below code snippet which can be used to create an object from dataproducts.  
CarObject is the output parameter which we are considering in an activity:
    public class CarObject
    {
        public string CarName { get; set; }
        public string CarManufacturer { get; set; }
        public int CarModelYear { get; set; }
    }
 
1.     Load the Job with the job-id of the workflow with the object set as its output parameter. Job ID is the unique identification of a workflow execution. You can get this ID from the Jobs table in trident database.
Job job = Job.Load(new Guid("2A8F88F5-81AE-434C-8CB1-DC9836681098"), registryConnection);
 
2.    Get the dataproduct instance of the workflow output.
DataProduct dataProduct = job.ActivityInstances[0].Outputs[0];
// In case there are multiple outputs then you can iterate through all the output parameters, to select the one which needs to be de-serialized
 
3.    Using XMLSerializer de-serialize the dataproduct output to the required object. In our example we de-serialize the string to type CarObject.
XmlSerializer serialize = new XmlSerializer(typeof(CarObject));
CarObject carObject = (CarObject)serialize.Deserialize(new StringReader(dataProduct.ContentsAsString));
 
Please let us know is this helps in answering your questions.
Regards,
Trident Support Team
Oct 19, 2010 at 8:06 AM
Edited Oct 19, 2010 at 8:06 AM

Hello Trident Team,

Although I haven't had any time to try that piece of code but I'm pretty sure that is what I am looking for. Thanks a lot for the help hope it will somehow help other developers as well.

Cheers,

Sam

P.S I love using this piece of novel technology keep it coming! And the tech support is awesome : )

Oct 25, 2010 at 12:41 AM

I have noticed that there is a panel called Data Products in Trident Provenance Form.  I assume this Data Products map the DataProduct instances.

If it is the case, how can we show an instance of DataProduct (here is the instance of [Car]) into the Trident provenace form?

 

Oct 25, 2010 at 5:07 PM

Hi,

We are looking into your question. We will get back to you as soon as possible.

Please let us know if you have any further questions/issues.
Thanks,
Trident Support Team

Oct 27, 2010 at 8:56 AM
Edited Oct 27, 2010 at 8:59 AM
Hi,
 
There are two ways of showing the workflow outputs in Trident provenance form.
1.   Using DataProducts:
You can use the DataProductWriter activity(shipped with Trident) to create an dataproduct for a workflow. Using the DataProductWriter activity you can create dataproduct for the following types.
a.       String  Type
b.      Images Type
c.       Byte Array Type
Also you can refer to the “Sample for showcasing Trident Data product activity” section in the samples page. These samples explains on how to use the data product writer activity.
 
2.   Using Workflow Outputs:
You can mark any output parameter of activity as workflow output and then this will show up in the Workflow outputs panel in Trident provenance form.
 
We would recommend to use the Workflow output approach for showing the instance of the [Car] as this is easier approach. You just need to mark the [Car] output parameter as workflow output and execute the workflow. Then trident will make sure to create a data product for [Car] output parameter and then it shows up in the workflow output panel in Trident provenance form.
 
Please let us know if this answers your questions.
Thanks,
Trident Support Team
Oct 28, 2010 at 4:05 PM

Hi,

Can you please let us know if our response helped in answering your questions?

Thanks,
Trident Support Team

Jan 25, 2011 at 2:30 PM

Hi,

We have not heard back from you for a long time and we hope this means your question has been answered. We are marking the thread as closed.

Please let us know in case you have any further questions/concerns.

Regards,
Trident Support Team

Feb 15, 2011 at 5:31 AM
tcvinay wrote:
 
 
We would recommend to use the Workflow output approach for showing the instance of the [Car] as this is easier approach. You just need to mark the [Car] output parameter as workflow output and execute the workflow. Then trident will make sure to create a data product for [Car] output parameter and then it shows up in the workflow output panel in Trident provenance form.
 
 

Hi, I am interested into how Trident formats and displays [Car] in the Trident provenance form.  Can we programmatically format the [Car] output?

Cheers

Feb 17, 2011 at 3:22 PM
baiqif wrote:
tcvinay wrote:
 
 
We would recommend to use the Workflow output approach for showing the instance of the [Car] as this is easier approach. You just need to mark the [Car] output parameter as workflow output and execute the workflow. Then trident will make sure to create a data product for [Car] output parameter and then it shows up in the workflow output panel in Trident provenance form.
 
 

Hi, I am interested into how Trident formats and displays [Car] in the Trident provenance form.  Can we programmatically format the [Car] output?

Cheers

 

Hi,

I am sorry, your question is not very clear. Based on the assumption that you might need more information about using workflow outputs, here is the response.

To create workflow output please follow the following steps:-

1)      Decide on which output of the activities in your workflow you need as workflow output.
2)      Right click on that activity output. Trident will prompt to mark that output as workflow output
3)      Click on it. You will see a change in output icon of that output indicating it is a workflow output.

You can format the output by changing the Output type in Workflow properties window. Currently, two output formats are supported this way, text\plain and, text\html.
Yes, you can programmatically format the output as shown in the above post (2nd post, dated Oct 18 2010) where you can get access to the workflow output programmatically and format as required.

Please let us know if you have any further query/concern or if this not the accurate response to your query.

Regards,
Support Team

Aug 12, 2011 at 7:53 AM

G'day Trident Team.  Do you have any information regarding the use of the Data Product Reader and, the use the of the Data Product Identifier?  Documentation and samples would be greatly appreciated

Cheers

Aug 12, 2011 at 8:45 AM

Hi,

We do not have any sample activtity such as Data Product Reader. We have a sample activity called Data Product Writer which you can find under the Sample for showcasing Trident Data product activity. This activity supports only few formats.  Having a single activtiy (reader or writer) which suports large number formats is not great, I guess. Instead, a specialised reader/writer for a given format is more resuable.

You may also search a sample from the repository  avialable at http://www.myexperiment.org/.

Please let me know if this helps.

-Regards 

Aug 17, 2011 at 3:51 AM

Thanks for getting back to me.  Is it possible for you to explain the operation of Data Product readers and the use of the data product identifier for Data Product readers and writers? I couldn't find any mention of these aspects in the documentation. Cheers