How to use Twitter Heron with Storm Flux - twitter

I am trying to migrate a project from apache-storm to twitter-heron. After a lot of struggle, I was able to get rid of most of the errors, such as use className: "org.apache.storm.kafka.ZkHosts" instead of className: "storm.kafka.ZkHosts". However, I am stuck in submitting the topology. I use Flux to submit the topology to storm.
I am getting a NullPointerException when it creates a CuratorFramework object in ZkState. On further digging I found an issue in github where it says, this issue is caused if the configurations about the zookeeper were not set.
Further debugging I found the issue is because I am missing the following configurations which are required in ZkState.java:46.
storm.zookeeper.session.timeout
storm.zookeeper.connection.timeout
storm.zookeeper.retry.times
storm.zookeeper.retry.interval
While I have managed to identify the issue, However, I am not sure where to add this in my config. Can someone please help me in where to add the above config. Thank you.
My Flux Config
name: "My_Topology"
components:
- id: "zkHosts"
className: "org.apache.storm.kafka.ZkHosts"
constructorArgs:
- "localhost:2181"
- id: "SpoutConfig"
className: "org.apache.storm.kafka.SpoutConfig"
constructorArgs:
- ref: "zkHosts" # brokerHosts
- "my-topic" # topic
- "/my-zkRoot" # zkRoot
- "my-id" # spoutId
properties:
- name: "zkServers"
value: ["localhost"]
- name: "zkPort"
value: 2181
- name: "zkRoot"
value: "/my-zkRoot"
- name: "retryInitialDelayMs"
value: 2000
- name: "retryDelayMultiplier"
value: 2
config:
topology.workers: 5
topology.testing.always.try.serialize: true
spouts:
- id: "kafka-spout"
className: "org.apache.storm.kafka.KafkaSpout"
parallelism: 1
constructorArgs:
- ref: "SpoutConfig"
bolts:
- id: "my-bolt"
className: "com.example.sample.MyBolt"
parallelism: 1
streams:
- name: "kafka_spout --> my_bolt"
from: "kafka-spout"
to: "my-bolt"
grouping:
type: SHUFFLE

you can add these to the config section to your Flux yaml file
config:
topology.workers: 5
topology.testing.always.try.serialize: true
storm.zookeeper.session.timeout: 30000
storm.zookeeper.connection.timeout: 30000
storm.zookeeper.retry.times: 5
storm.zookeeper.retry.interval: 2000

We have natively integrated Storm Flux into Heron to make it easy. With Heron ECO - you can write the topologies for two different API
Native Heron API
Storm API
For additional information, please take a look at the ECO documentation here
https://apache.github.io/incubator-heron/docs/developers/java/eco-api/

Related

log4j2.configurationFile does not accept yaml?

I migrated my old project from some SimpleLogger to Log4J. I hate Log4j because it is extremely difficult to set up.
Now, how do I feed some config into it?
Configuration:
status:info
name: YAMLConfigTest
thresholdFilter:
level: info
Appenders:
Console:
name: STDOUT
target: SYSTEM_OUT
PatternLayout:
Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"
I tried loading it using the log4j2.configurationFile variable. But log4j always tries to interpret the file as XML. Why is that? Is there anything that I can do about it?
ERROR StatusLogger Error parsing /fullpath/log4j2.yaml
org.xml.sax.SAXParseException; systemId: file:///fullpath/log4j2.yaml; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
...
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
at de.tisje.dendro.plot.swing.Kurvenplot.<clinit>(Kurvenplot.java:91)
Alternative solution would be to put the file somewhere where it can be found automatically.
Where do I put the file in a standard eclipse/gradle project?
do I have to tell gradle how to handle it?
thanks
The XML ConfigurationFactory is a "catch-all" factory: it tries to read those files that were rejected by other configuration factories.
While the YAML configuration factory is distributed with log4j-core, it requires additional runtime dependencies to be active (this is mentioned briefly in the documentation). You need to add jackson-dataformat-yaml to your project.

Where can I put test data that is not part of a model?

I want to test against a list of invalid email addresses. At the moment, they live in my setup method:
def setup
#invalid_email_addresses = [
'plainaddress',
'##%^%#$##$##.com',
'#domain.com',
'Joe Smith <email#domain.com>',
'email.domain.com',
'email#domain#domain.com',
'.email#domain.com',
'email.#domain.com',
'email..email#domain.com',
'あいうえお#domain.com',
'email#domain.com (Joe Smith)',
'email#domain',
'email#-domain.com',
'email#domain.web',
'email#111.222.333.44444',
'email#domain..com'
]
end
This makes the method rather long. I would like to move them to a yml file:
# test/fixtures/email_addresses.yml
invalid_email_addresses:
- 'plainaddress'
- '##%^%#$##$##.com'
- '#domain.com'
- 'Joe Smith <email#domain.com>'
- 'email.domain.com'
- 'email#domain#domain.com'
- '.email#domain.com'
- 'email.#domain.com'
- 'email..email#domain.com'
- 'あいうえお#domain.com'
- 'email#domain.com (Joe Smith)'
- 'email#domain'
- 'email#-domain.com'
- 'email#domain.web'
- 'email#111.222.333.44444'
- 'email#domain..com'
But that results in an error for each test:
ActiveRecord::Fixture::FormatError: fixture key is not a hash: /Users/stefan_edberg/Rails/tennis_app/test/fixtures/emaild_addresses.yml, keys: ["invalid_email_addresses"]
If not in fixtures, where should I put these email addresses?
The error shared itself conveys that there is some problem in parsing the YAML contents. I saved the following contents in a file test.yml on my Desktop
# test/fixtures/email_addresses.yml
invalid_email_addresses:
- 'plainaddress'
- '##%^%#$##$##.com'
- '#domain.com'
- 'Joe Smith <email#domain.com>'
- 'email.domain.com'
- 'email#domain#domain.com'
- '.email#domain.com'
- 'email.#domain.com'
- 'email..email#domain.com'
- 'あいうえお#domain.com'
- 'email#domain.com (Joe Smith)'
- 'email#domain'
- 'email#-domain.com'
- 'email#domain.web'
- 'email#111.222.333.44444'
- 'email#domain..com'
and then tried loading it from irb and it successfully loaded:
Please Note: Initially when I copied the YAML contents as it is in my file and tried loading it, I encountered parsing error and then I removed the following entry and tried again and the parse was successful
- 'あいうえお#domain.com'`
That entry contains Unicode characters. As YAML is indentation-sensitive copying that entry as it is in my file made the indentation inconsistent which caused parse error. Fixing the indentation for that entry made the parse successful.

How to avoid "knp_menu.factory" deprecation?

I'm trying to use KNPMenuBundle with Sumfony 3.3 but I'm getting this annoying warning:
Autowiring services based on the types they implement is deprecated
since Symfony 3.3 and won't be supported in version 4.0. You should
rename (or alias) the "knp_menu.factory" service to
"Knp\Menu\FactoryInterface" instead.
Trace:
{..../vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php:344:
}
I did not set this knp_menu.factory at all, probably it was automatically set by the bundle.
Do I need to configure anything to make this warning go away?
I resolved it like this:
app.component_menu.builder:
class: AppBundle\Component\Menu\Builder
arguments: ['#knp_menu.factory', '#event_dispatcher']
calls:
- [setAuthorizationChecker, ['#security.authorization_checker']]
Knp\Menu\ItemInterface:
class: Knp\Menu\MenuItem
factory: ['#app.component_menu.builder', mainMenu]
arguments: ['#knp_menu.matcher']
tags:
- { name: knp_menu.menu, alias: main }
Knp\Menu\FactoryInterface:
alias: knp_menu.factory
public: false
Not sure if this is the recommended resolution, but it removes the deprecation notices.

SymfonyCMF RoutingBundle Doctrine PHPCR configuration error

i'm following the tutorial Creating a Basic CMS but after configurate the CMF RoutingBundle like it's shown in Enable the Dynamic Router i got the following error when i try to load the fixture data
PHP Catchable fatal error: Argument 2 passed to Doctrine\Bundle\PHPCRBundle\Initializer\GenericInitializer::__construct() must be of the type array, none given
here is my config.yml
cmf_routing:
chain:
routers_by_id:
cmf_routing.dynamic_router: 20
router.default: 100
dynamic:
enabled: true
persistence:
phpcr:
route_basepath: /cms/routes
you seem to have gotten a version mixup. you need either the 1.1.* family of phpcr-odm and phpcr-bundle with the routing-bundle 1.2.* or phpcr at 1.0.* and routing at 1.1.*
did you do any composer tricks or are the dependencies allowing this incompatible combination?

Syncing Security Level from Rally to JIRA

I'm trying to sync Defects from Rally to Bugs in JIRA (syncing new Bugs from JIRA to Defects in Rally is working fine), but I was getting the following error due to Security Level in JIRA being a required field:
[2012-08-16 08:24:52 Z] ERROR : JiraConnection.rescue in attempt_create - Trying to create issue: 'Testing Security Level' resulted in exception SOAP::FaultError
[2012-08-16 08:24:52 Z] WARN : JiraConnection.initialize - com.atlassian.jira.rpc.exception.RemoteValidationException: {security=Security Level is required.} : []
I created a custom field in Rally with the following properties:
Name: Security Level
Display Name: Security Level
Type: Drop Down List
Drop Down list Values: None, Reporter and Company, Vendor and Company, Company Only
Hidden: Unchecked
Occurrences: 1
Required: Unchecked
and added the following to my XML configuration:
<FieldMapping>
...
<Field><Rally>Security Level</Rally><Other>Security Level</Other></Field>
...
</FieldMapping>
<OtherFieldHandlers>
...
<OtherEnumFieldHandler>
<FieldName>Security Level</FieldName>
<Mappings>
<Field><Rally>None</Rally><Other>-1</Other></Field>
<Field><Rally>Reporter and Company</Rally><Other>10050</Other></Field>
<Field><Rally>Vendor and Company</Rally><Other>10052</Other></Field>
<Field><Rally>Company Only</Rally><Other>10031</Other></Field>
</Mappings>
</OtherEnumFieldHandler>
...
</OtherFieldHandlers>
but now it's failing with:
[2012-08-16 09:45:32 Z] ERROR : Connector.block in validate - FieldMapping: Rally field "Security Level" not found
[2012-08-16 09:45:32 Z] ERROR : ConnectorRunner.rescue in run_services - Unexpected exception occurred
[2012-08-16 09:45:32 Z] ERROR : ConnectorRunner.exception - Message Invalid Configuration
I've tried different combinations of "Security Level", "securityLevel", etc. for the field name in Rally and updated the XML file accordingly when I've tried different combinations, but I always get the same "not found" error.
Am I missing something obvious here? Is there a more standard way of mapping Security Level?
Cheers,
Andrew.
Currently the Rally JIRA Connector cannot sync issues from Rally which require a Security Level in JIRA because the connector only uses the createIssue call and not the createIssueWithSecurityLevel call.
for the field names in Rally, the wsapi strips out spaces and underscores - try just SecurityLevel in the field mapping and in the field handler.
hope that helps

Resources