BasicPipeline.onRun() NOT RUNNING: Problem with upload/update to server

182 views
Skip to first unread message

Guillermo Suárez de Tangil

unread,
Nov 19, 2013, 2:43:07 PM11/19/13
to funf-de...@googlegroups.com
Hi all,

I'm trying to run my own Funf and I'm experiencing some problems setting up the upload and update config

THE PROBLEM:

The thing is that if I set up some local properties, funf works good in my device. However, when I try to configure HttpConfigUpdater and HttpArchive, for some reason Funf ignores me. 

MY TRIES:
  • I've check the server and is responding when I connect through the browser. I was also going through the logcat and there is no error prompted or something like that. 
  • I was also inserting some Log messages around and it doesn't even run the method JsonObject getConfig() in HttpConfigUpdater. 
  • In fact, the Pipilene manages to schedule the alarm every 160, 60 and 10 secs, but it nevers execute the RunUpdateAction.
I'm pretty sure I'm mission something basic. 

FINDINGS:

Funf never executes the following method from the pipeline: 

public void onRun(String action, JsonElement config){ ... if (ACTION_UPLOAD)....

I have seen some related posts suggesting that the problem might be in the configuration file. However, I have double checked it and I'm not getting any parse error. 

MY CONFIGURATION

This is my local config file: 
<resources>
    <string name="default_pipeline">{
"name": "myFunf",
        "version":1,
        "@type": "edu.mit.media.funf.pipeline.BasicPipeline",         
        "archive": {
                "@schedule": {"interval": 160}
        },
        "upload": {
                "url": \"http://***.***.***.238:8000/upload\",
                "@type": "edu.mit.media.funf.storage.HttpArchive", 
                "@schedule": {"interval": 60}
        },
        "update": {
                "url": \"http://***.***.***.238:8000/config\",
                "@type": "edu.mit.media.funf.config.HttpConfigUpdater",  
                "@schedule": {"interval": 10}
        },
        "data": [
        "edu.mit.media.funf.probe.builtin.BatteryProbe" 
        ]
     }</string>
</resources>

HELP:

I'm a bit desperate because I've been debugging for hours and I can't spot the problem. Might be that I'm still a newbie in funf and I'm missing something important. I would appreciate some help from you guys. 
 
Thanks in advance, 
Guillermo.

Guillermo Suárez de Tangil

unread,
Nov 19, 2013, 3:16:46 PM11/19/13
to funf-de...@googlegroups.com
Ok, question:

Am I missing... 

(1) ... declaring:

<service android:name="edu.mit.media.funf.storage.UploadService"></service>
<service android:name="edu.mit.media.funf.config.HttpConfigUpdater"></service>
 <service android:name="edu.mit.media.funf.pipeline.BasicPipeline"></service>

(2) ... and running:

Intent archiveIntent = new Intent(context, BasicPipeline.class);
archiveIntent.setAction(BasicPipeline.ACTION_ARCHIVE);
context.getApplicationContext().startService(archiveIntent);
 
archiveIntent.setAction(BasicPipeline.ACTION_UPDATE);
context.getApplicationContext().startService(archiveIntent);
 
archiveIntent.setAction(BasicPipeline.ACTION_UPLOAD);
context.getApplicationContext().startService(archiveIntent);


...any service in Funf? 

I was checking some old examples and sometimes the do something like that. However, I don't think this is the case as this classes are not Android services. 

Any insight in this regard would also be welcome.

Thanks again. 

Guillermo Suárez de Tangil

unread,
Nov 19, 2013, 4:36:53 PM11/19/13
to funf-de...@googlegroups.com
[Sorry for the spam]

Looks like I was checking the older tutorial.

As simple as:

      funfManager = ((FunfManager.LocalBinder)service).getManager();
      pipeline = (BasicPipeline) funfManager.getRegisteredPipeline(PIPELINE_NAME);

Very elegant Funf 0.4. Congratulations!!

Cheers, 
Guillermo

Guillermo Suárez de Tangil

unread,
Nov 20, 2013, 7:58:53 AM11/20/13
to funf-de...@googlegroups.com
I found the problem, not sure if it is a conceptual problem or that I have actually found a bug in the scheduler.

I actually manage to upload the archived files and to download the configuration, but not when I scheduled it. 

If I set up a configuration like this:

        "upload": {
                "url": \"http://***.***.***.238:8000/upload\",
                "@type": "edu.mit.media.funf.storage.HttpArchive", 
                "@schedule": {"interval": 60}
        }, 

I would expect that every 60 seconds the scheduler will wake up and call the upload action. Isn't it? 

Instead, every 60 seconds I get the following event...

11-20 13:39:15.350: V/Funf(1010): {"@type":"edu.mit.media.funf.probe.builtin.AlarmProbe","exact":false,"interval":60}
 
...  but no other event is triggered. In other words, Funf is waking up, but is not uploading the information. It looks like when the config file is parsed, instead of scheduling "edu.mit.media.funf.storage.HttpArchive" action it sends an AlarmProbe that does nothing. 

The same happens when I schedule any Probe such as, for instance, the LocationProbe.

Any suggestion?

Thanks in advance.

Guillermo Suárez de Tangil

unread,
Nov 20, 2013, 10:28:52 AM11/20/13
to funf-de...@googlegroups.com
I just found out that somebody already reported this issue 20 days ago:


Any ideas on how to patch it?

Markus Perndorfer

unread,
Nov 26, 2013, 11:23:48 AM11/26/13
to funf-de...@googlegroups.com
The problem (as far as I remember) lies in the way the schedules are handled.

For every schedule (e.g. every 200sec) a new Intent is registered via the Android AlarmManager.

The problem is the handing of the intent (FunfManager.onStartCommand). The action data is extracted from the intent, and a with it, a new probe is created. This new probe hasn't all the necessary handlers/callbacks registered to trigger the pipeline/sensor.

In my opinion this is a conceptual problem.
I don't have time to fix it, I reverted to Funf version 0.4.x instead.

Hope this helps,
Markus

Guillermo Suárez de Tangil

unread,
Nov 26, 2013, 5:54:17 PM11/26/13
to funf-de...@googlegroups.com
Hi Markus,

Thanks for your feedback. 

I might downgrade to funf 0.4.x as well ;)

I gave it a try, but I gave up after while. 

Let's hope somebody from the core team finds some time to read us and may be provide some insights.

Cheers,
Guillermo.

Mrinal Sharma

unread,
Nov 29, 2014, 7:55:37 PM11/29/14
to funf-de...@googlegroups.com
I dont know if you are still seeing this issue but the workaround is to add "strict":true to config 
 
"@schedule": {"interval": 10, "duration" : 10, "strict": true}

Mrinal 

Palash Patil

unread,
Jun 17, 2015, 10:48:17 PM6/17/15
to funf-de...@googlegroups.com
Dear Mrinal

Thanks for the highly needed answer. I had spent lot of time in understanding the code but no luck. Your answer helped a lot.

Thanks
Palash
Reply all
Reply to author
Forward
0 new messages