Import Action in New Oozie Editor - cloudera

I am trying to understand how to import an action (like a job I created in the job designer) with the new Oozie editor that there is. Here is the best documentation I can find to describe the basics of the changes:
http://gethue.com/new-apache-oozie-workflow-coordinator-bundle-editors/
My question is... Where is this button (highlighted) in the new editor:
I want to be able to import a job that I created in the job designer like in the old editor. There is a "sub workflow button", but that will only allow me to import workflows and not jobs. The import action would let me pick from all jobs and workflows. I can't find this in the new editor (SS in link). Any thoughts?

From Cloudera forum admin (http://community.cloudera.com/t5/Web-UI-Hue-Beeswax/Import-Action-in-New-Oozie-Editor/m-p/44098#M1648):
Currently there is no way to import jobs from the Job Designer in the
Workflow Editor.
This will be back in Hue 4 though.

Related

import com.google.android.gms.ads.reward cannot be resolved

I am trying to deploy in my App the RewardedVideoAd of Admob, but when I put the import of the library I get this error:
import com.google.android.gms.ads.reward cannot be resolved
Someone knows why this happen?
It took 5 days to get it. I did receive no answer from here... but thinking in all those people that will face this problem in the future, I want to say my solution, and this is: create a complete new project from a .metada from 0, and import the new version of google play service lib (very easy to get here in stackOverflow) , import it. If you have a facebook project, remove it, and import from 0 as well. When you have finished to import all your libraries, create a new project, the yours, and copy, file per file, everything. This will work for sure.

How to import env variables in hue oozie workflow manager?

I'm trying to import workflow in HUE oozie workflow editor. but Section like this
<env-var>HDFS_DIR=${HOME_DIR}</env-var>
<env-var>TARGET_TABLE=${SOURCE_TABLE}</env-var>
<env-var>SOURCE_DATABASE=${SOURCE_DATABASE}</env-var>
didn't want to import. How can i fix it ?

'Insufficient privileges' on plone python script

I have this python script designed to rebuild the catalog for a particular content type, however when I visit it's url in the browser I get 'insufficient privileges' even when logged in as admin. How can I run something like this?
import plone.api
catalog = plone.api.portal.get_tool(name='portal_catalog') for brain in catalog(portal_type='Resource'):
obj = brain.getObject()
catalog.catalog_object(obj)
You don't need plone.api for this. Thus remove plone.api import and do:
catalog = context.portal_catalog
ScriptPython is restricted Python, that means that you can not import every Python module you want. That could the reason that you can't use plone.api in ScriptPython. But you can import getToolByName in that Script and get tools like the portal_catalog with it.
from Products.CMFCore.utils import getToolByName
catalog = getToolByName('portal_catalog')
If create your script in filesystem, you ca run.
bin/instace run your_script
But in your case, you don't need import plone.api
Plone in ZMI have many restrictions for import something.
See more informations about portal_catalog in official plone site
Documentation Query

How to develop a PySide application plugin?

As I understand it Qt provides 2 main plugin mechanisms:
Plugins that extend Qt "Qt Extensions"
Plugins that extend applications developed with Qt
I'm interested in developing plugins for my application (2).
I use PySide but can't find any resources about developing application plugins using PySide/PyQt.
Following the C++ Qt documentation I understand that the application has to use the Q_DECLARE_INTERFACE() macro and the plugins have to use both Q_INTERFACES() and Q_EXPORT_PLUGIN2() macros but I don't know the code they represent to try and translate it to python. Or is there another way I've missed?
Update:
The closest thing to a solution I could find so far is Alex Martelli's answer to a similar question. Although it looks like it would work I'd rather use an official Qt approach to avoid any cross-platform issues.
I think Qt's plugin system is intended to allow people to write C++ plugins compiled as binaries. I don't even know if it's theoretically possible to write plugins in Python that will use a C++ binary interface like that.
If you want to support Python plugins your best bet would be to use one of the many pure python plugin systems out there. I have written a PySide app that uses YAPSY to load plugin scripts. YAPSY is a very simple, compact plugin module. It's very easy to include directly in your app as it's a single file, and is BSD licensed so you can use it commercially. Just search for it on Google. I was even able to package my app using py2exe and still retain the ability to import python source file plugins from a plugin directory.
I'm a fan of the Roll Your Own approach.
By a plugin, I mean:
Plugin: a module or package loaded during runtime which augments or modifies the main module's behavior
I see two requirements for a plugin:
Can the main module load the plugin during runtime?
Is data accessible between the main module and the plugin?
Assumptions
Developing a plugin system is highly subjective. There are many design decisions to make and there is no One True Way. The usual constraints are time, effort, and experience. Be aware that assumptions must be made and that the implementation often defines terminology (e.g. "plugin" or "package"). Be kind and document those as best as possible.
This plugin implementation assumes:
A plugin is either a Python file or a directory (i.e. "plugin package")
A plugin package is a directory with structure:
plugin_package/
plugin_package.py <-- entry point
other_module.py <-+
some_subdir/ |- other files
icon.png <-+
Note that a Plugin package isn't necessarily a Python package. Whether or not a plugin package is a Python package depends on how you want to handle imports.
The plugin name is the same as the plugin entry point's file name, as well as the plugin package directory
The QApplication's QMainWindow is the primary source of data to share from the main module
1. Loading a plugin module
Two pieces of information are required to load a plugin module: the path to the entry point and the plugin's name. How these are obtained can vary and getting them usually requires string/path parsing. For what follows, assume:
plugin_path is the absolute path of the plugin entry point and,
plugin_name is the plugin name (which is the module name by the above assumptions).
Python has implemented and re-implemented the import mechanism numerous times. The import method used at the time of writing (using Python 3.8) is:
import importlib
from importlib.util import spec_from_loader, module_from_spec
from importlib.machinery import SourceFileLoader
loader = SourceFileLoader(plugin_name, plugin_path)
spec = spec_from_loader(plugin_name, loader)
plugin_module = module_from_spec(spec)
spec.loader.exec_module(plugin_module)
# Required for reloading a module
sys.modules[plugin_name] = plugin_module
# # This is how to reload a module
# importlib.reload(plugin_module)
It's probably a good idea to include error handling and a record of which modules have been loaded (e.g. by storing them in a dict). Those details are excluded here for brevity.
2. Sharing data
There are two directions which data may be shared:
Can the main module access the plugin module's data?
Can the plugin module access the main module's data?
The main module can access plugin data for free after import (by definition). Simply access the plugin module's __dict__:
# Accessing plugin data from the main module
some_data = plugin_module.__dict__.get('data')
Accessing the main module's data from within the plugin is a trickier problem.
As stated above, I usually consider the QMainWindow as synonymous with the end-user's notion of "the application". It's the primary widget users interact with and, as such, typically houses most of the data or has easy access to it. The challenge is sharing the QMainWindow instance.
The solution to sharing QMainWindow instance data is to make it a singleton. This forces any QMainWindow to be the main window users interact with. There are several ways to create singletons in Python. The two most common ways are probably using metaclasses or modules. I've had the most success using the module singleton approach.
Break the QMainWindow code into a separate Python module. At the module level, create but don't initialize a QMainWindow. Create a module-level instance so that other modules can access the instance as a module attribute. Don't initialize it because init requires a QApplication (and because the main window module is not the application entry point).
# main_window.py
from PySide2 import QtWidgets
class MyMainWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
main_window_instance = MyMainWindow.__new__(MyMainWindow)
Use a separate module, such as main.py, for the application entry point. Import the main window instance, create the QApplication, and initialize the main window.
# main.py
import sys
# Importing the instance makes it a module singleton
from main_window import main_window_instance
from PySide2 import QtWidgets
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main_window_instance.__init__()
main_window_instance.show()
sys.exit(app.exec_())
Importing the main window instance is what makes it a singleton. Creating the QApplication here isn't strictly necessary (it's a singleton, too), but feels cleaner to me.
Now, when plugins are loaded during runtime, they can import the main_window_instance. Because the main_window module has already been loaded by the main.py entry point, it's the main window used by the main module (and not a new instance). Data from the main module can now be accessed from the plugin module.
# plugin.py
# The plugin can now access the main module's data
from main_window import main_window_instance
main_window_instance.setWindowTitle('Changed from plugin')
Comments
The minimum setup requires three files: main.py, main_window.py, and plugin.py. The main_window.py defines and instantiates the main window, the main.py makes it a singleton and initializes it, and the plugin.py imports and uses the instance.
Lots of details were left out in hopes that the primary components could be made apparent. Ideally, the Qt and Python documentation should be enough to fill in the gaps...
There are further considerations, such as how to distribute and manage plugins. Plugins could be hosted remotely, packaged as (zip) archives, bundled as proper Python packages, etc. Plugins can be as simple (or as complex) as you want. Hopefully this answer provides ample inspiration for how you want your plugin system to look.

How do I make new/edits to nodes pass through intermediary for acceptance first?

I would like my users to be able to create and edit their own content. However, after they create new content, and after they edit it, I would like to have a way to accept those changes. Meanwhile, before changes are accepted, the previous version of the node will remain visible. Can this be accomplished with workbench, or is there another route I should take?
You can make the node content type unpublished by default from [admin/structure/types/manage/article] where "article" is the node content type...and then you can use "views" module to display all un published node... then you can manage the unpublished nodes and make theme published...
then
you can use rules module to make the node unpublish after its edited by the user
Take a look at the Maestro module. It is a way to implement workflows into your site.
From the project page:
The Maestro module is a workflow engine/solution that will facilitate
simple and complex business process automation. The first release of
this module will be for Drupal v7.
Maestro has a number of components that include the workflow engine
and the visual workflow editor. The workflow editor is used to define
the workflow, creating a workflow template. The workflow engine runs
in the backgound and executes the workflow tasks, testing the tasks
execution results and branch the workflow if required. The workflow
engine will run every x seconds and execute all tasks that are in the
queue which have not yet completed. Once they execute and return a
success status, the engine will archive them and step the workflow
forward. Both these components have been developed to support any
number of different task types. New task types can be developed and
added much like the Drupal CCK module can support new field types.
I have installed and configure the "Maestro" Module in Drupal Commons.
actually in Maestro Module every time we should Load the Workflow and it will go through step by step.
Like
Admin: Publishing Workflow Load
User1: Assigend to add new Content.
User2: Review Content
User3: Publish Content.
Here I want to Skip the Admin Step Is it possible? When user create new content type it is automatically go for review.

Resources