You could try something like,

   def export_csv_and_push_to_s3
      export_to_csv unless csv_exists?
      push_to_s3

The fact it takes a long time shouldn't matter (so long as you've set your
DJ timeout appropriately). Presumably you're storing your CSV somewhere
locally and your object has a way of retrieving that (csv_exists?) If any
part of export_csv_and_push_to_s3 fails it'll skip the CSV generation next
time if it has completed it already.

You could optionally delay push_to_s3 altho I'm not really seeing the
benefit.

Either way you definitely should not (IMO) be attempting to orchestrate
some sequence during the original job scheduling.


On Tue, Jun 16, 2015 at 10:28 PM, amtest <vgrkrish...@gmail.com> wrote:

> Hi, thanks for the response paul, actually i am trying to do export the
> csv, so that will take bit time to getting data and push to s3 that's why i
> put the delay, so one delay is fine to doing this long job? is this the
> normal way basically i am get rid of this multiple delay, because some
> times it wrap up wrong data
>
> On Wednesday, 17 June 2015 03:23:12 UTC+4, Paul Makepeace wrote:
>>
>> If you want to sequence the jobs why not just make it one job where the
>> second "job" is just a method call? One important purpose of asynchronous
>> jobs like this is to get them out of the way of a main loop. By making it
>> one job you've done that so there's no obvious (so far) pressure to punt
>> the other one since you're not in that main loop any more.
>>
>> Your pseudo code leaves me with more questions than answers so maybe
>> explain what you're trying to actually do?
>>
>> On Tue, Jun 16, 2015 at 10:49 AM, amtest <vgrkr...@gmail.com> wrote:
>>
>>>
>>>    I have one sudo code here, using delayedjob with rails, actually
>>> tired but in some cases it getting weird, i want to call the first delay
>>> and after that is finished, then only start second delay, so i have used
>>> the priority. Is this the proper way to do this or is anything wrong?
>>>
>>> class Core
>>>   def foo
>>>     priority = 0
>>>     if condition1
>>>       if condition2
>>>         self.delay(priority: priority).foo1(priority)
>>>       end
>>>       self.delay(priority: priority).foo1(priority)
>>>     end
>>>   end
>>>
>>>   def foo1(priority)
>>>     if condition1
>>>       if condition2
>>>         priority +=1
>>>         self.delay(priority: priority).foo1(priority)
>>>       end
>>>       priority +=1
>>>       self.delay(priority: priority).foo1(priority)
>>>     end
>>>   endend
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ruby on Rails: Talk" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to rubyonrails-ta...@googlegroups.com.
>>> To post to this group, send email to rubyonra...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/rubyonrails-talk/76889966-18f5-40b7-a112-036a18679f83%40googlegroups.com
>>> <https://groups.google.com/d/msgid/rubyonrails-talk/76889966-18f5-40b7-a112-036a18679f83%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/90f4fdb9-7ea8-4232-af4a-5dfdf8bd9840%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/90f4fdb9-7ea8-4232-af4a-5dfdf8bd9840%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAMEJyiub%2BaFjPbA%2BewPOpnUsvcHw0vmbnKhP8WiHQoLmfOq_4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to