Closed idlenexusgaming closed 8 years ago
If I got you right.. You want exactly this: https://github.com/3rdpartyeve/phealng Maybe the documentation of phealng is a little bit deprecated, because the latest updates are not mentioned but it's really easy to understand. This bundle is using phealng btw.
I hope this will be helpful :smile:
Yeah, that's the one I was talking about. It takes several minutes before it does anything (I laced it with print statements, so I know). I wanted to tie into this fetcher bundle to have a local db populated with their api keys as they register on the site. I wanted to use fetcher to force a quick api call, populate the db with the results, and then my app will do stuff with it, e.g., check corp ticker, check predefined skill sets, et cetera.
Well damn, I just realized gearman is throwing a WorkerDoesNotExistException exception... guess it's back to the drawing board before I can move forward on this issue.
Do you have supervisor running with the gearman worker? What does
gearadmin --status
show?
I uninstalled ubuntu package gearman-job-server and installed gearman-server and gearman-tools
I am now receiving this
PHP Warning: GearmanClient::doBackground(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:433 in /home/awe/www/intrepidcrossing/vendor/mmoreram/gearman-bundle/Mmoreram/GearmanBundle/Service/GearmanClient.php on line 235
gearadmin --status returns nothing but it is clearly running:
13:52 0:00 /usr/bin/perl /usr/bin/gearmand -d --pidfile=/var/run/gearmand.pid
With the gearman-job-server package instead I receive the following:
root@host:~# gearadmin --status . root@host:~# gearadmin --workers 33 127.0.0.1 - : .
executing the console command eve:api:scheduler under dev env I get this now so it's doing something.
[2016-01-06 14:05:29] doctrine.DEBUG: SELECT a0_.keyID AS keyID0, a0.vCode AS vCode1, a0.active AS active2, a0.errorCount AS errorCount3 FROM apiKey a0 WHERE (SELECT COUNT(*) FROM apiCall a1 WHERE a1.keyID = a0.keyID) = 0 [2016-01-06 14:05:29] doctrine.DEBUG: SELECT a0.apiCallID AS apiCallID0, a0.earliestNextCall AS earliestNextCall1, a0.cachedUntil AS cachedUntil2, a0.active AS active3, a0.errorCount AS errorCount4, a1.apiID AS apiID5, a1.mask AS mask6, a1.worker AS worker7, a1.section AS section8, a1.name AS name9, a1.callInterval AS callInterval10, a0.ownerID AS ownerID11, a0.apiID AS apiID12, a0.keyID AS keyID13 FROM apiCall a0 INNER JOIN api a1 ON a0.apiID = a1.apiID WHERE a0.active = 1 AND (a0.cachedUntil IS NULL OR a0.cachedUntil <= ?) AND (a0.earliestNextCall IS NULL OR a0.earliestNextCall <= ?) ["2016-01-06 19:05:29","2016-01-06 19:05:29"] [2016-01-06 14:05:30] doctrine.DEBUG: SELECT t0.keyID AS keyID_1, t0.vCode AS vCode_2, t0.active AS active_3, t0.errorCount AS errorCount_4 FROM apiKey t0 WHERE t0.keyID IN (?) [["123456"]]
also to actually answer your question, supervisor is running.
Jan05 0:13 /usr/bin/python /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
sudo -u www-data /usr/bin/php /home/awe/www/intrepidcrossing/app/console gearman:worker:execute TariochEveapiFetcherBundleComponentWorkerTariochEveapiFetcherEveWorker --env=prod --no-interaction
[Mmoreram\GearmanBundle\Exceptions\WorkerDoesNotExistException]
doctrine_cache:
providers:
gearman_cache:
type: file_system
namespace: doctrine_cache.ns.gearman
gearman:
bundles:
TariochEveapiFetcherBundle:
name: TariochEveapiFetcherBundle
active: true
include:
- Component/Worker
defaults:
method: doNormal
iterations: 50
callbacks: false
job_prefix: null
generate_unique_key: true
workers_name_prepend_namespace: false
servers:
localhost:
host: 127.0.0.1
port: 4730
gearmand 35611 gearman 9u IPv4 156511 0t0 TCP :4730 (LISTEN) gearmand 35611 gearman 10u IPv6 156512 0t0 TCP :4730 (LISTEN)
Maybe to narrow this down, can you instead of using supervisord, run the gearman worker manually:
sudo -u www-data /usr/bin/php /home/awe/www/intrepidcrossing/app/console gearman:worker:execute TariochEveapiFetcherBundleComponentWorkerTariochEveapiFetcherEveWorker --env=prod
then check
gearadm --status
and then run the trigger command:
sudo -u www-data /usr/bin/php /home/awe/www/intrepidcrossing/app/console eve:api:schedule --env=prod
Okay. The WorkerDoesNotExistException doesn't let me go to step 2.
Yeah its not the actual worker name. It should be app/console gearman:worker:execute TariochEveapiFetcherEveWorker
Also you can use app/console gearman:worker:list to identify the worker name.
I resolved this by changing the name of the worker as you suggested. I also had to change the fetcher to curl in your pheal DI bundle because of an issue with new version of guzzle. I changed the caching to memcache just because. It seems to be running now. I see mysql queries every minute.
Now I just need to figure out the best approach to adding api keys to the database. What is the minimal lines of code to pull into my app to make this happen as people register for teamspeak? I want to automate certain badges and permissions based on skill sets they have.
Simply add the key to the key table and it will fetch all authorized and in api table configured apis.
I've added the new key to apiKey table and it doesn't seem to be fetching anything. Also, I found where I got "TariochEveapiFetcherBundleComponentWorkerTariochEveapiFetcherEveWorker." It is in your readme file. :)
/usr/bin/php /home/awe/www/intrepidcrossing/app/console eve:api:schedule --env=prod runs every minute in the cron logs. It doesn't look like supervisor is starting the children.
When I run it from the command line:
@Worker\service : tarioch.eveapi.worker.eve
@worker\iterations : 50
@Worker\#jobs : 1
@Worker\jobs
# TariochEveapiFetcherEveWorker~apiUpdate
@worker\servers :
#localhost - 127.0.0.1:4730
@Worker\description :
No description is defined
[2016-01-13 19:08:30] loaded. Ctrl+C to break
CallId 1
CallId 2
CallId 4
CallId 5
CallId 11
CallId 3
CallId 12
Data confirmed in the character sheet table. I guess I need to figure out why supervisord isn't functioning properly
I guess at this point everything is working except for supervisord which is beyond the scope of this thread. Unless you wish to provide some tips about supervisord, we can close this issue.
Fixed readme and closing this now
Greetings! I would like to use your bundle to pull api information and use it as part of an authentication system. Can you provide some tips to get me started? I already installed and got the app working as per your readme file. Now, all I can do is enter a key into the database, but I'd much rather use your tool to make the eve api call and then I can do stuff with the resulting data. I need to supply the key id and vcode to something in your bundle, maybe the phealfactory class?
I'm a little lost on this because I'm forcing myself to learn symfony to better support the developers at my company and am also relearning php. I do have a working site and about 20 years of linux sysadmin experience under my belt, so you don't need to dumb down any replies :)
I tried using the phealng bundle by itself, but I keep getting several minute delays before it actually executes the api call. I've determined it wasn't network or server issues, but anyway. I wanted to give your pheal interface a shot since it clearly works.
Your assistance is greatly appreciated.