Enable ORA Grading MFE in Tutor Olive

I want to enable ora-grading mfe in tutor 15.3.5. I found one similar topic but still can’t figure out the exact way. Please suggest detailed steps to add ora-grading in Tutor Olive (15.3.5). Any help would be appreciated!

are you a developer?
You can refer to this PR and make a plugin to apply it.
You will need do the following:

  • Add ORA_GRADING_MICROFRONTEND_URL
  • Add a custom MFE ORA Grading
  • Create a waffle flag openresponseassessment.enhanced_staff_grader and enable it to everyone.

Thanks for the reply! I’m a newbie openedx developer, hence finding difficulty in creating the plugin. I’ve added this in my plugin.py

from tutormfe.plugin import MFE_APPS
@MFE_APPS.add()
def _add_my_mfe(mfes):
    mfes["ora-grading"] = {
        "repository": "https://github.com/openedx/frontend-app-ora-grading.git",
        "port": 1993,
        "version": "open-release/olive.4",
    }
    return mfes

but I’m getting this error

tutor plugins enable ora
Error applying action 'plugins:loaded:ora': func=<function discover_package.<locals>.load at 0x7f32ef5bb940> contexts=['plugins']'
Traceback (most recent call last):
  File "env/bin/tutor", line 8, in <module>
    sys.exit(main())
  File "env/lib/python3.8/site-packages/tutor/commands/cli.py", line 26, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "env/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "env/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "env/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "env/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "env/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "env/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "env/lib/python3.8/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "env/lib/python3.8/site-packages/tutor/commands/plugins.py", line 140, in enable
    plugins.load(plugin)
  File "env/lib/python3.8/site-packages/tutor/plugins/__init__.py", line 93, in load
    hooks.Actions.PLUGIN_LOADED(name).do()
  File "env/lib/python3.8/site-packages/tutor/core/hooks/actions.py", line 122, in do
    self.do_from_context(None, *args, **kwargs)
  File "env/lib/python3.8/site-packages/tutor/core/hooks/actions.py", line 141, in do_from_context
    callback.do(
  File "env/lib/python3.8/site-packages/tutor/core/hooks/actions.py", line 35, in do
    self.func(*args, **kwargs)
  File "env/lib/python3.8/site-packages/tutor/plugins/v1.py", line 77, in load
    entrypoint.load()
  File "env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "env/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/ora_grading/enable_ora/plugin.py", line 10, in <module>
    from tutormfe.plugin import MFE_APPS
ImportError: cannot import name 'MFE_APPS' from 'tutormfe.plugin' (env/lib/python3.8/site-packages/tutormfe/plugin.py)

I also added ORA_GRADING_MICROFRONTEND_URL in below file tutor/env/apps/openedx/settings/lms/developmemt.py, and openresponseassessment.enhanced_staff_grader waffle flag

What am I missing?

@khushi i think there is an issue with import .
could you try using this

from tutormfe.hooks import MFE_APPS

@MFE_APPS.add()
def _add_my_mfe(mfes):
    mfes["mymfe"] = {
        "repository": "https://github.com/myorg/mymfe.git",
        "port": 2001,
        "version": "me/my-custom-branch-or-tag", # optional, will default to the Open edX current tag.
    }
    return mfes

Hope it help !

I tried this too but getting similar import error! I think it is because my tutor (version 15.3.5 ) is not having hooks.py in this path - env/lib/python3.8/site-packages/tutormfe/

ImportError: cannot import name 'MFE_APPS' from 'tutormfe.hooks' 

How can I solve this?

@khushi , yes you get it right .
you can check here for more info on this

i think you should do something like this

Adding new MFEs

Other Tutor plugin developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, a new configuration setting should be created with the “_MFE_APP” suffix. This configuration setting should include the name, git repository (and optionally: git branch) and development port. For example:

config = {
    "defaults": {
        "MYMFE_MFE_APP": {
            "name": "mymfe",
            "repository": "https://github.com/myorg/mymfe",
            "port": 2001,
            "version": "me/my-custom-branch", # optional
        }
    }
}

The MFE assets will then be bundled in the “mfe” Docker image whenever it is rebuilt with tutor images build mfe. Assets will be served at http(s)://{{ MFE_HOST }}/{{ MYMFE_MFE_APP[“name”] }}. Developers are free to add extra template patches to their plugins, as usual: for instance LMS setting patches to make sure that the LMS correctly connects to the MFEs.


Check for your mfe version and then go to Release history => tutor-mfe · PyPI
and check in Project description . i think you can get your answers there , i also added that block related to add new mfe from there .
hope , it work now !

Check your tutor mfe version and use a corresponding method. For tutor mfe v15, you can use this doc.

I added ora-grading in the config and built the mfe image but start -d gives this error as the docker image for ora-grading version 15 is not found

"ORA_GRADING_MFE_APP": {
            "name": "ora-grading",
            "repository": "https://github.com/openedx/frontend-app-ora-grading",
            "port": 1993,
        },
docker compose -f /tutor/env/local/docker-compose.yml -f /tutor/env/local/docker-compose.prod.yml -f /tutor/env/local/docker-compose.tmp.yml --project-name tutor_local stop
docker compose -f /tutor/env/local/docker-compose.yml -f /tutor/env/dev/docker-compose.yml -f /tutor/env/dev/docker-compose.tmp.yml -f /tutor/env/dev/docker-compose.override.yml --project-name tutor_dev up --remove-orphans --build -d ora-grading
[+] Running 1/1
 ✘ ora-grading Error                                                                                                                                                                                          9.7s 
Error response from daemon: manifest for overhangio/openedx-ora-grading-dev:15.0.7 not found: manifest unknown: manifest unknown
Error: Command failed with status 18: docker compose -f /tutor/env/local/docker-compose.yml -f /tutor/env/dev/docker-compose.yml -f /tutor/env/dev/docker-compose.tmp.yml -f /tutor/env/dev/docker-compose.override.yml --project-name tutor_dev up --remove-orphans --build -d ora-grading

That config works for tutor local or tutor k8s
For tutor dev you have to use bind mount according to the doc.
If you’ve built the mfe image then you can run tutor local launch or tutor local quickstart, I don’t remember the exact syntax for v15.