Modify

Opened 9 years ago

Last modified 9 years ago

#52 assigned task

PBSQuery + uWSGI

Reported by: anonymous Owned by: bas
Priority: major Milestone:
Component: pbs Version: 4.6.0
Keywords: Cc:

Description

When i use Django embbedded server everything is fine but when i use uwsgi i get this error:

Could not make a connection with jim-Aspire-5742G

Request Method: GET Request URL: http://localhost:8000/ Django Version: 1.6 Exception Type: PBSError Exception Value:

Could not make a connection with jim-Aspire-5742G

Exception Location: /usr/local/lib/python2.7/dist-packages/PBSQuery.py in _connect, line 103 Python Executable: /usr/local/bin/uwsgi Python Version: 2.7.6 Python Path:

['/usr/local/lib/python2.7/dist-packages/',

'.', , '/home/jim/Documents/dbikas/lib/python2.7', '/home/jim/Documents/dbikas/lib/python2.7/plat-x86_64-linux-gnu', '/home/jim/Documents/dbikas/lib/python2.7/lib-tk', '/home/jim/Documents/dbikas/lib/python2.7/lib-old', '/home/jim/Documents/dbikas/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/jim/Documents/dbikas/local/lib/python2.7/site-packages', '/home/jim/Documents/dbikas/lib/python2.7/site-packages']

Any ideas???

Attachments (0)

Change History (6)

comment:1 Changed 9 years ago by bas

  • Priority changed from major to minor
  • Status changed from new to assigned
  • Type changed from defect to task

Which version of torque are you ussing? Which version of pbs_python. The batch server is:

  • jim-Aspire-5742G

mabye a dns issue, must use fully qualified name, or the django/http user is not allowed to connect to the server.

comment:2 Changed 9 years ago by anonymous

  • Priority changed from minor to major

Hi Torque version: 4.1.3 PBS python version: 4.4.0 Django 1.6 Python 2.7.6

With manage.py runserver 127.0.0.1:8000, i can connect to torque's server: "jim-Aspire-5742G" with pbs python But when i use the same django project under uWSGI, i get the PBSError: Could not make a connection with jim-Aspire-5742G

With >qmgr -c "p s" i get:

# Create queues and set their attributes. # # # Create and define queue batch # create queue batch set queue batch queue_type = Execution set queue batch resources_default.nodes = 1 set queue batch resources_default.walltime = 01:00:00 set queue batch enabled = True set queue batch started = True # # Set server attributes. # set server scheduling = True set server acl_hosts = jim-Aspire-5742G set server managers = jim@jim-Aspire-5742G set server managers += root@jim-Aspire-5742G set server operators = root@jim-Aspire-5742G set server default_queue = batch set server log_events = 511 set server mail_from = adm set server scheduler_iteration = 600 set server node_check_rate = 150 set server tcp_timeout = 300 set server job_stat_rate = 45 set server poll_jobs = True set server mom_job_sync = True set server keep_completed = 300 set server submit_hosts = localhost:8001 set server submit_hosts += localhost set server allow_node_submit = True set server next_job_number = 0 set server moab_array_compatible = True

And i run uWSGI: uwsgi --http :8001 --chdir myproject --wsgi-file myproject/wsgi.py --stats 127.0.0.1:9191

Part of my code in models.py: import pbs from PBSQuery import PBSQuery

class Server(object):

c = pbs.pbs_connect(str('jim-Aspire-5742G')) p = PBSQuery(str('jim-Aspire-5742G')) def init(self, server_name):

info = self.p.get_serverinfo().items()[0] ...

/usr/local/lib/python2.7/dist-packages/PBSQuery.py in _connect, line 104:

99 def _connect(self): 100 """Connect to the PBS/Torque server""" 101 self.con = pbs.pbs_connect(self.server) 102 if self.con < 0: 103 str = "Could not make a connection with %s\n" %(self.server) 104 raise PBSError(str)

comment:3 Changed 9 years ago by anonymous

To be more specific, if i run: import pbs c = pbs.pbs_connect(str('jim-Aspire-5742G')) #jim-Aspire-5742G = my torque server name in terminal with ipython or with django: manage.py runserver everything is fine. But if i run it under uwsgi, i get c = -1 all the time

My uwsgi.ini: [uwsgi] chdir = /home/jim/workspace/myproject env DJANGO_SETTINGS_MODULE=myproject.settings wsgi-file = myproject/wsgi.py http = 127.0.0.1:8001 #socket = 127.0.0.1:8001 #uid = 1001 #gid = 1001 stats 127.0.0.1:9191

comment:4 Changed 9 years ago by bas

I do not know anything about uwsig. For me it is still a permission problem. As root user your code works. But when you are using the uwsgi method it does not work. So the question is under which user id does this process run. From your qmgr output i see that these users can query:

set server scheduling = True
set server acl_hosts = jim-Aspire-5742G
set server managers = jim@jim-Aspire-5742G
set server managers += root@jim-Aspire-5742G
set server operators = root@jim-Aspire-5742G

So the uwsgi must be run under jim or root

comment:5 Changed 9 years ago by bas

see also #53

comment:6 Changed 9 years ago by anonymous

i have already tried to run uwsgi under both user ids(jim and root), but still it cannot even locate the pbs.pbs_default() server.

When i run uwsgi, my log file is:

* Starting uWSGI 2.0.9 (64bit) on [Mon Mar 30 19:08:02 2015] * compiled with version: 4.8.2 on 10 March 2015 14:48:28 os: Linux-3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 nodename: jim-Aspire-5742G machine: x86_64 clock source: unix detected number of CPU cores: 4 current working directory: /home/jim/workspace detected binary path: /usr/local/bin/uwsgi ...

So, one other thought might be: The uwsgi's nodename: jim-Aspire-5742G, is the same as the torque's server name: jim-Aspire-5742G. Is there any possibility, this affecting something in the pbs connection proccess??

I cannnot think, or even imagine of what else might be the cause of this error.

Add Comment

Modify Ticket

Change Properties
Action
as assigned The owner will remain bas.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from bas to the specified user. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.