Apache Zeppelin - error: overloaded method value run with alternatives - angularjs

I am trying to use the angular binding feature available in Apache Zeppelin in the following code:
val ab10 = z.sqlContext.sql("select "+ z.angular("selectVari0") + " from MyDF")
ab10.toDF.registerTempTable("ab0")
z.angularBind("abb0", ab10)
val selvar = z.getInterpreterContext()
z.angularUnwatch("abb0")
z.angularWatch("abb0", (before:Object, after:Object) => {
z.run(15, selvar)
})
I get the following error:
ab10: org.apache.spark.sql.DataFrame = [BMI: double]
warning: there was one deprecation warning; re-run with -deprecation for details
selvar: org.apache.zeppelin.interpreter.InterpreterContext = org.apache.zeppelin.interpreter.InterpreterContext#216b8218
<console>:31: error: overloaded method value run with alternatives:
(x$1: java.util.List[Object],x$2: org.apache.zeppelin.interpreter.InterpreterContext)Unit <and>
(x$1: String,x$2: String)Unit
cannot be applied to (Int, org.apache.zeppelin.interpreter.InterpreterContext)
z.run(15, selvar)
^
I tried anther example from here. I got similar errors. I was not able to find any documentation to fix this error.

As stated in error message, you have to overloaded .run methods, with following signatures:
(x$1: java.util.List[Object],x$2: org.apache.zeppelin.interpreter.InterpreterContext)Unit <and>
(x$1: String,x$2: String)Unit
Please, try to call it like this:
import collection.JavaConverters._
z.run(List(15).asJava, selvar)

Related

Problem in R: package reticulate does not work with doparallel

I recently bumped into a new problem with reticulate and doparallel that I never seen before.
The following code works well with %do% (which is regular for loop) BUT NOT with %dopar% (doParallel package)
library(doParallel)
library(reticulate)
cl <- makeCluster(4)
registerDoParallel(cl)
foreach(j=1:4,.combine=rbind,.packages = "reticulate") %dopar%
{
test <- "Testing to see if dopar can recognize reticulate"
py_run_string("for i in range(len(r.test)): print(i)")
}
Here is the error message:
"Error in { :
task 1 failed - "RuntimeError: Evaluation error: object 'test' not found."
By default, test is an R object and when using reticulate, r.test will be recognized as an object in python py_run_string. However, the dopar created different cluster and therefore the r.test is not recognized anymore. The strange thing in here is that I have test ran inside the foreach loop and reticulate loaded for each small cluster.
Any hint would help. Thanks in advance.

Locust-plugins; Uncaught exception in event handler: TypeError: fire_deprecated_request_handlers() missing 1 required positional argument: 'context'

I've built a working locust-plugins web-driver script and was attempting to add some transactional timers and when I run the script I'm getting an error:
[2022-01-03 10:34:55,525] LHTU05CD943125T/ERROR/root: Uncaught exception in event handler:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python38-32\lib\site-packages\locust\event.py", line 40, in fire
handler(**kwargs)
TypeError: fire_deprecated_request_handlers() missing 1 required positional argument: 'context'
The script continues to run but at every event call I see the above error.
I'm using locust version 2.5.1 and locust-plugins version 2.1.1.
#task
def open_digipass_homepage(self):
self.clear()
# CALL THIS ONCE
start_time = time.monotonic()
self.client.get("https://myurl-stage.com/")
self.environment.events.request.fire(
request_type="transaction",
name="T000_SitePage",
response_time=(time.monotonic() - start_time) * 1000,
response_length=0,
exception=None
)
Your self.environment.events.request.fire call is missing an argument it's expecting called context. This may or may not be a bug (not sure something like this should be required, if it is), but you should be able to work around it. Here's the documentation on the event signature:
http://docs.locust.io/en/stable/api.html#locust.event.Events.request
Which links to this page on what the Context is supposed to be:
http://docs.locust.io/en/stable/extending-locust.html#request-context
Looks like it's a dictionary with whatever stuff you want to get passed around. Based on some code in the tests I'd assume adding even just context={} to your call should work. Something like this:
self.environment.events.request.fire(
request_type="transaction",
name="T000_SitePage",
response_time=(time.monotonic() - start_time) * 1000,
response_length=0,
exception=None,
context={}
)

howtographql + React tutorial : Error: Cannot find module './generated/prisma.graphql'

I'm following the howtographql + React tutorial right now. I'm currently at the beginning of the tutorial when I have to define my queries, mutation and stuff in my schema.graphql. But according to the tutorial, I have to import prisma.graphql from the generatedfolder by writing the following line :
# import Link, Vote, LinkSubscriptionPayload, VoteSubscriptionPayload from "./generated/prisma.graphql"
I indeed generated the serverfolder which contains everything except this file that is supposed to be generated as well I guess.
Apparently, I should be able to run the server using yarn startbut when I'm doing so, I have this message :
Error: Cannot find module './generated/prisma.graphql'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
at resolveFileName (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:29:39)
at resolveFrom (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:43:9)
at module.exports (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:46:41)
at resolveModuleFilePath (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:150:24)
at /Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:187:30
at Array.forEach (<anonymous>)
at collectDefinitions (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:185:16)
at Object.importSchema (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:73:14)
at mergeTypeDefs (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-yoga/dist/index.js:412:37)
I don't understand what I'm doing wrong...
Do you guys have any idea ?

Grunt uglify fail while with JS Parse error

I've created an Angular app which works fine on locally.
However when I try to build (grunt build) to generate the dist folder that will contain my app with everything minified and ready to deploy, I have a error at the Uglify step.
Error:
JS_Parse_Error {
message: 'Unexpected token operator «=», expected punc «,»',
filename: '../../.tmp/concat/scripts/scripts.js',
...
I've read that people had similar errors, just the operator was a different one in the error message.
If someone has a clue.
My issue came from the function's parameters with a default value.
For example:
function (a = myValue, b) {
...
For some reason, giving that default value was not supported.
I replaced it by doing something like:
function (a, b) {
a = typeof a !== 'undefined' ? a : myValue;
...
You will find explanations of that behaviour by googling (uglify, ES6), I'm just offering the solution of my specific error.

How to use projection with GAE?

I have the following code:
employees = Employee.all()
employees.projection('first_name')
employees.filter('passport_id =', passport_id)
employees.order('-added')
results = employees.fetch(5)
Second line is not allowed:
AttributeError: 'Query' object has no attribute 'projection'
Another approach also returns the error:
employees = db.Query(Employee, projection=('first_name'))
TypeError: __init__() got an unexpected keyword argument 'projection'
But if I read the doc correctly, it should be supported.
Which version of AppEngine SDK are you running? projection queries were added in version 1.6.5

Resources