# Error When running Remote Task ModuleEngagementWorkflowTask for Insights

**URL:** <https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852>\
**Category:** Site Operators\
**Created:** [April 28, 2021, 4:49am UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852 "2021-04-28T04:49:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![c3ho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/c3ho/32/2362_2.png) [@c3ho](https://discuss.openedx.org/u/c3ho)\
**Post date:** [April 28, 2021, 4:49am UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852/1 "2021-04-28T04:49:05Z")

</div>

Hope you guys are doing well. I’ve gotten all the remote-tasks to run except for the last one `ModuleEngagementWorkflowTask`. I installed insights using the single server installation method at [Confluence](https://openedx.atlassian.net/wiki/spaces/OpenOPS/pages/43385371/edX+Analytics+Installation)

Using the following command:

```auto
remote-task --host localhost --user ubuntu --remote-name analyticstack --skip-setup --wait ModuleEngagementWorkflowTask \
--date $(date +%Y-%m-%d -d "2021-04-28") \
--indexing-tasks 5 \
--throttle 0.5 \
--n-reduce-tasks 1

```

I’m getting the following error:

```auto
2021-04-28 04:28:30,005 ERROR 17422 [luigi-interface] rpc.py:134 - Failed connecting to remote scheduler 'http://localhost:8082'
Traceback (most recent call last):
  File "/var/lib/analytics-tasks/analyticstack/venv/src/luigi/luigi/rpc.py", line 129, in _fetch
    response = self._fetcher.fetch(full_url, body, self._connect_timeout)
  File "/var/lib/analytics-tasks/analyticstack/venv/src/luigi/luigi/rpc.py", line 85, in fetch
    resp = self.session.get(full_url, data=body, timeout=timeout)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=8082): Max retries exceeded with url: /api/ping (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5c27ce7d90>: Failed to establish a new connection: [Errno 111] Connection refused',))
2021-04-28 04:28:30,006 INFO 17422 [luigi-interface] rpc.py:126 - Retrying attempt 2 of 3 (max)
2021-04-28 04:28:30,007 INFO 17422 [luigi-interface] rpc.py:116 - Wait for 30 seconds
2021-04-28 04:29:00,032 ERROR 17422 [luigi-interface] rpc.py:134 - Failed connecting to remote scheduler 'http://localhost:8082'
Traceback (most recent call last):
  File "/var/lib/analytics-tasks/analyticstack/venv/src/luigi/luigi/rpc.py", line 129, in _fetch
    response = self._fetcher.fetch(full_url, body, self._connect_timeout)
  File "/var/lib/analytics-tasks/analyticstack/venv/src/luigi/luigi/rpc.py", line 85, in fetch
    resp = self.session.get(full_url, data=body, timeout=timeout)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/var/lib/analytics-tasks/analyticstack/venv/local/lib/python2.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=8082): Max retries exceeded with url: /api/ping (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5c27d0bdd0>: Failed to establish a new connection: [Errno 111] Connection refused',))

```

I fixed the 8082 issue by using the command `luigid --port 8082` on another shell of the instance, but now I am also getting the following:

```auto
2021-04-28 04:39:30,141 WARNING 18183 [edx.analytics.tasks.util.elasticsearch_target] elasticsearch_target.py:88 - ConnectionError((<urllib3.connection.HTTPConnection object at 0x7fa79c289910>, u'Connection to 172.17.0.1 timed out. (connect timeout=60)')) caused by: ConnectTimeoutError((<urllib3.connection.HTTPConnection object at 0x7fa79c289910>, u'Connection to 172.17.0.1 timed out. (connect timeout=60)'))

```

I checked to see if there’s an elasticsearch instance running on the insights server using the `systemctl` command… and there isn’t. Anyone have any tips on resolving this?

---

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/jill/32/3188_2.png) [@jill](https://discuss.openedx.org/u/jill)\
**Post date:** [April 28, 2021, 6:34am UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852/2 "2021-04-28T06:34:22Z")

</div>

You’re doing great to get this far @c3ho ! The analytics system isn’t designed for single instance deployments, and so there’s a lot missing. OpenCraft have done some exploration into how to make analytics run on a single (ubuntu) instance, and this is among several changes which would need to be made to the playbooks and configuration to fully automate this.

> [@c3ho](#):
>
> `2021-04-28 04:28:30,005 ERROR 17422 [luigi-interface] rpc.py:134 - Failed connecting to remote scheduler 'http://localhost:8082'`  
> …  
> I fixed the 8082 issue by using the command `luigid --port 8082` on another shell of the instance, but now I am also getting the following:

I think you can also fix this issue by passing `--local-scheduler` to the ModuleEngagementWorkflowTask, see [task docs](https://edx-analytics-pipeline-reference.readthedocs.io/en/latest/running_tasks.html#id17).

> [@c3ho](#):
>
> I checked to see if there’s an elasticsearch instance running on the insights server using the `systemctl` command… and there isn’t. Anyone have any tips on resolving this?

You can deploy elasticsearch using the edx:configuration ansible role, see e.g. [this ironwood.2 patch](https://github.com/open-craft/configuration/compare/opencraft-release/ironwood.2...open-craft:jill/analytics-single). Then you’ll need to tell the pipeline what host/port to contact elasticsearch, e.g. [here on `devstack.cfg`](https://github.com/edx/edx-analytics-pipeline/blob/c01411226337194c764821209804ee393e037950/config/devstack.cfg#L80-L82).

---

<div class="post-metadata">

**Author:** ![c3ho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/c3ho/32/2362_2.png) [@c3ho](https://discuss.openedx.org/u/c3ho)\
**Post date:** [April 28, 2021, 6:41am UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852/3 "2021-04-28T06:41:43Z")

</div>

@jill Thanks a lot for the quick reply! I’ll look into it right away, I’ve read a ton of your replies to other people struggling with the installation as well and they’ve been extremely helpful!

---

<div class="post-metadata">

**Author:** ![c3ho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/c3ho/32/2362_2.png) [@c3ho](https://discuss.openedx.org/u/c3ho)\
**Post date:** [April 28, 2021, 5:33pm UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852/4 "2021-04-28T17:33:16Z")

</div>

Solution works!

Wanted to note for other people:  
There should be an elasticsearch.service now. When you run `systemctl status elasticsearch.service` a few addresses show up.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/a/ac17621d1809e42e6848b8ab44510370f22f3746.png)

I used the publish\_address in the http row and used that value for host in the override.cfg file within `/var/lib/analytics-tasks/analyticstack/repo`. So it looks something like this:

```auto
[elasticsearch]
host = ["<publish_address_value>"]

```

---

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/jill/32/3188_2.png) [@jill](https://discuss.openedx.org/u/jill)\
**Post date:** [April 29, 2021, 2:20am UTC](https://discuss.openedx.org/t/error-when-running-remote-task-moduleengagementworkflowtask-for-insights/4852/5 "2021-04-29T02:20:14Z")

</div>

Hooray! Glad you sorted this out @c3ho !
