airavata-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Suresh Marru <sma...@apache.org>
Subject Re: Question about null check in GFacUtils
Date Wed, 03 Jul 2013 16:59:35 GMT
On Jul 3, 2013, at 12:19 AM, Saminda Wijeratne <samindaw@gmail.com> wrote:

> because status is already recorded through setStatus function in a previous
> iteration. So its enough to only update time.

After thinking through this a bit, I think we should avoid updating only the time. This assumption
holds true if only one thread is updating the status. Lets say a call back came back or a
non-cordinating client is fetching the status some how and used the setStatus to update it.
Now the original thread unintentionally changes the status time. So I think it will be better
of to be explicit with updating both status and time at the same time.

+ 1 for the code walk through.

Suresh

> 
> On Tue, Jul 2, 2013 at 11:59 PM, Amila Jayasekara
> <thejaka.amila@gmail.com>wrote:
> 
>> Hi Saminda,
>> 
>> Still I dont get why you need to record only time in waitFor method.
>> Anyhow I am re-factoring this code. Lets do a code review and see whether i
>> have missed anything.
>> 
>> Thanks
>> Amila
>> 
>> 
>> On Tue, Jul 2, 2013 at 9:22 PM, Saminda Wijeratne <samindaw@gmail.com
>>> wrote:
>> 
>>> That is true, if the status was different from the previously read
>> status,
>>> then only the "setStatus" is called where the status and the time is
>>> recorded. or else we only record the time.
>>> 
>>> 
>>> On Tue, Jul 2, 2013 at 8:56 PM, Amila Jayasekara <
>> thejaka.amila@gmail.com
>>>> wrote:
>>> 
>>>> Hi Saminda,
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Tue, Jul 2, 2013 at 7:14 PM, Saminda Wijeratne <samindaw@gmail.com
>>>>> wrote:
>>>> 
>>>>> is it the name you are confused with or the function of it?
>>>>> 
>>>>> The waitFor function runs until the job is completed or failed.
>>>> 
>>>> 
>>>> Correct. But actual status of the job is report to statusChange method.
>>>> statusChange method calls "setStatus" method. The setStatus method has
>> a
>>>> call to
>>> "GFacUtils.updateApplicationJobStatus(context,job.getIDAsString(),
>>>>                GFacUtils.getApplicationJobStatus(status));"
>>>> 
>>>> So whether job is finished or failed is already recorded through the
>>>> setStatus method. I guess we dont need to record it again in waitFor
>>>> method.
>>>> 
>>>> Thanks
>>>> Amila
>>>> 
>>>> 
>>>> 
>>>>> The way it
>>>>> knows that the job is completed is by checking the gram status of the
>>> job
>>>>> periodically via a while loop.
>>>>> 
>>>>> On Tue, Jul 2, 2013 at 6:34 PM, Amila Jayasekara <
>>>> thejaka.amila@gmail.com
>>>>>> wrote:
>>>>> 
>>>>>> The "updateApplicationJobStatusUpdateTime" method is called from
>>>>>> GramJobSubmissionListener.waitFor method. I dont understand why
>> that
>>>>> method
>>>>>> is called from waitFor method.
>>>>>> 
>>>>>> Could you please explain ?
>>>>>> 
>>>>>> Thanks
>>>>>> Amila
>>>>>> 
>>>>>> 
>>>>>> On Tue, Jul 2, 2013 at 5:26 PM, Saminda Wijeratne <
>>> samindaw@gmail.com
>>>>>>> wrote:
>>>>>> 
>>>>>>> Hi Amila,
>>>>>>> 
>>>>>>> These are my additions. Basically we are recording the status
of
>>> the
>>>>>>> application execution with the time which it was observed.
>> However
>>>>>>> sometimes the same status is observed continuously by the
>>>>>>> observers/listeners defined in the provider for that job. In
>> those
>>>>> times
>>>>>> we
>>>>>>> update only the time which that same status was observed last.
>>>>>>> 
>>>>>>> If you think that the name of the function is confusing shall
we
>>>> change
>>>>>> it?
>>>>>>> These are util functions which the providers may or may not use
>> for
>>>>> their
>>>>>>> convenience.
>>>>>>> 
>>>>>>> Saminda
>>>>>>> 
>>>>>>> 
>>>>>>> On Tue, Jul 2, 2013 at 4:57 PM, Amila Jayasekara <
>>>>>> thejaka.amila@gmail.com
>>>>>>>> wrote:
>>>>>>> 
>>>>>>>> Hi Lahiru,
>>>>>>>> 
>>>>>>>> I have few more questions related to this.
>>>>>>>> In GFacUtils class I see following 2 methods;
>>>>>>>> 
>>>>>>>>    public static void
>>>>>>>> updateApplicationJobStatusUpdateTime(JobExecutionContext
>> context,
>>>>>> String
>>>>>>>> jobId, Date statusUpdateTime)
>>>>>>>>    public static void
>>>> updateApplicationJobStatus(JobExecutionContext
>>>>>>>> context, String jobId, ApplicationJobStatus status, Date
>>>>>>> statusUpdateTime)
>>>>>>>> 
>>>>>>>> What is the difference between about 2 methods ? More
>> precisely I
>>>> am
>>>>>>> having
>>>>>>>> difficulty understanding the need for 1st method.
>>>>>>>> 
>>>>>>>> Thanks
>>>>>>>> Amila
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Tue, Jul 2, 2013 at 3:13 PM, Suresh Marru <
>> smarru@apache.org>
>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> On Jul 2, 2013, at 2:19 PM, Saminda Wijeratne <
>>>> samindaw@gmail.com>
>>>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> Are we not going to allow using the GFac libraries
as
>>>> standalone
>>>>>>> tool?
>>>>>>>> It
>>>>>>>>>> could be useful for devs who dont want to use the
workflow
>>>>> context
>>>>>> to
>>>>>>>> run
>>>>>>>>>> applications.
>>>>>>>>> 
>>>>>>>>> I would vote against direct use of GFac API from clients.
We
>>> need
>>>>> to
>>>>>>>>> brainstorm and decide on the component level API's and
their
>>>>>>> implications
>>>>>>>>> once we discuss Airavata 1.0( may be also 2.0) roadmaps.
>>>>>>>>> 
>>>>>>>>> In short, I see the need for GFac API's to evolve to
>> facilitate
>>>>> more
>>>>>>>>> dynamism and multi-phased interactions between workflow
>>>> interpreter
>>>>>> and
>>>>>>>>> GFac. I think we should limit all client integrations
to
>>> Airavata
>>>>> API
>>>>>>> so
>>>>>>>> we
>>>>>>>>> can put in extra effort to ensure backward compatibility
is
>>>>>> maintained
>>>>>>>>> within major versions.
>>>>>>>>> 
>>>>>>>>> Suresh
>>>>>>>>> 
>>>>>>>>>> On Tue, Jul 2, 2013 at 9:53 AM, Lahiru Gunathilake
<
>>>>>>> glahiru@gmail.com
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> It's not required now. Please remove it.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Lahiru
>>>>>>>>>>> 
>>>>>>>>>>> On Tuesday, July 2, 2013, Amila Jayasekara wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> Hi All,
>>>>>>>>>>>> 
>>>>>>>>>>>> In GFacUtils I see methods like follows;
>>>>>>>>>>>> 
>>>>>>>>>>>> public static void
>>>>>>>>>>> updateApplicationJobStatusUpdateTime(JobExecutionContext
>>>>>>>>>>>> context, String jobId, Date statusUpdateTime){
>>>>>>>>>>>>       AiravataAPI airavataAPI =
>>>>>>>>>>>> context.getGFacConfiguration().getAiravataAPI();
>>>>>>>>>>>> if(airavataAPI != null){
>>>>>>>>>>>> try {
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> airavataAPI.getProvenanceManager().updateApplicationJobStatusUpdateTime(jobId,
>>>>>>>>>>>> statusUpdateTime);
>>>>>>>>>>>> } catch (AiravataAPIInvocationException e)
{
>>>>>>>>>>>> log.error("Error in updating application
job status time
>>>>>>>>>>>> "+statusUpdateTime.toString()+" for job Id
"+jobId+"!!!",
>>> e);
>>>>>>>>>>>> }
>>>>>>>>>>>>       }
>>>>>>>>>>>> }
>>>>>>>>>>>> 
>>>>>>>>>>>> Any particular reason to have "if(airavataAPI
!= null)"
>>>>>> condition ?
>>>>>>>>>>>> 
>>>>>>>>>>>> Thanks
>>>>>>>>>>>> Amila
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> --
>>>>>>>>>>> System Analyst Programmer
>>>>>>>>>>> PTI Lab
>>>>>>>>>>> Indiana University
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 


Mime
View raw message