Python - Thread中的线程 - kosher?(Python - Threads inside Thread - kosher?)
试图实现一个泛型类,它将使用Paramiko执行远程命令执行。
面对这个问题。
继承threading.Thread的类的init ()方法将连接到主机,run()方法将在远程主机上执行命令。
现在正在执行的命令是一个守护进程。
该守护进程将准备接受stdin上的输入,并将在stdout和stderr上喷出消息。
我们应该如何处理这个stderr,stdout阅读同时把东西放在stdin上? 我正在考虑使用另外3个线程来定期检查流句柄并以这种方式处理远程守护程序的I / O.
想法?
Trying to implement a generic class which will do remote command execution using Paramiko.
Faced with this question.
The init() method of the class which is inheriting threading.Thread will do the connect to the host and the run() method will do the command execution on the remote host.
Now the command which is getting executed is a daemon.
That daemon will be ready to accept inputs on the stdin and will be spewing out messages on the stdout and stderr.
How should we handle this stderr, stdout reading while putting stuff on stdin ? I was thinking of using 3 more threads to do regular checking on the stream handles and handling the I/O to the remote daemon in that way.
Thoughts ?
原文:https://stackoverflow.com/questions/16782531
最满意答案
好几件事
- 您不需要在用户名和登录名周围使用
[]
。- 您似乎正在尝试将登录更改为自身。 这不可能是正确的。
尝试这个:
ALTER USER myuser WITH LOGIN = myLOGIN
请参阅MSDN上的
ALTER USER
文档。The problem seems to be a bug in SQL Server 2005.
It is fixed at SP2. So, The the fix is to upgrade it to SP2 or above.
相关问答
更多-
它的顺序。 OUTPUT子句应该在INSERT和VALUES行之间。 只需移动你的,就像这样: INSERT INTO [DD#WORK].[dbo].[ebhFifoQueue] ([cs-uri-stem],[cs-uri-query],[date],[time],[queue_state],[process_id],[simulation_start_time],[num_failures]) OUTPUT INSERTED.id VALUES (@cs_uri_stem,@cs_uri_query ...
-
您的问题是您尝试从子查询中进行选择而不为结果集指定别名。 您所要做的就是更改您的查询 string query = "select sum(See) as[All] ,(select top 1 See from StateSite where StatDate=@StatDate)as[Now], (select top 1 See from StateSite where StatDate=@Yesterday)as[Last],(select sum(See) from (select top 7 ...
-
在2000版的OSQL中, ED曾经是一个命令,并且在某些情况下,系统在命令之前忽略了前导空格 - 所以请确保第4行的第一个非空格字符不是ED并且看看它是否能够治愈它 对于2005年和2008年 ,文档都说: !! osql不再支持和ED命令。 然而,即使它们没有被处理,命令仍然可能被识别 ,并且行为的差异纯粹是命令在它前面具有前导空格时是否被识别。 显然,这在2008年是如此,但不是在2005年。 In the 2000 version of OSQL, ED used to be a command, ...
-
与Go或分号无关, 您正在更新Lending.ApplicationFee但它不会出现在FROM子句中。 UPDATE Lending.ApplicationFee SET Lending.ApplicationFee.FeeTypeId = T.LookupId FROM dbo.TmpFeesToRules2 TT INNER JOIN dbo.TmpFeesToRules1 T ON T.Name = TT.Name WHERE Lending.ApplicationFee.FeeId = TT.F ...
-
使用类似c的短分配运算符(如+= , -=等)仅在SQL Server 2008之后才有效。 您不能将它与SQL Server 2005一起使用。 The use of the c-like short assigment operators like +=, -= etc. is only valid from SQL Server 2008 onward. You can't use it with SQL Server 2005.
-
如何修复SQL Server 2005中“LOGIN”附近的错误语法(How to fix incorrect syntax near 'LOGIN' in SQL Server 2005)[2023-04-07]
好几件事 您不需要在用户名和登录名周围使用[] 。 您似乎正在尝试将登录更改为自身。 这不可能是正确的。 尝试这个: ALTER USER myuser WITH LOGIN = myLOGIN 请参阅MSDN上的ALTER USER文档。 The problem seems to be a bug in SQL Server 2005. It is fixed at SP2. So, The the fix is to upgrade it to SP2 or above. -
一个服务器级对象(登录)映射到多个数据库级对象(用户)。 登录不能映射到数据库中的多个用户,但可以映射到每个数据库中最多一个用户。 因此,您需要为这些用户创建新登录,但将其映射到现有用户。 这是通过ALTER USER命令完成的。 或者,如果您对Mike和John登录没有任何用处,除了将它们映射到现有用户之外,您也可以这样做。 One server-level object (login) is mapped to multiple database-level objects (users). A log ...
-
如何在SQL Server 2005中使用动态SQL来更改登录名(How to use dynamic SQL in SQL Server 2005 to alter login)[2024-03-07]
声明包括在单行上分配初始值是SQL Server 2008中的一项新功能 - 您无法在2005年完成这项工作。 将您的行更改为: declare @SQL nvarchar(max) set @SQL = N'' The declaration including an assignment of an initial value on a single line is a new feature in SQL Server 2008 - you cannot do this in 2005. Cha ... -
使用密码散列登录脚本,然后在删除数据库之后和还原数据库备份之前,在目标服务器上删除并重新创建它们。 这就是我们使用脚本软件编写SQL2005登录脚本的方法。 您可能想尝试使用该软件 - www.dbghost.com - 或者构建自己的解决方案。 Script the logins with the password hashed and then drop and re-create them on your target server after you drop the database and be ...
-
SQL Server 2000中的WITH仅允许设置FillFactor 。 查看文档: http://msdn.microsoft.com/en-us/library/aa258255%28v=sql.80%29.aspx 从WITH子句中删除其他选项。 WITH in SQL Server 2000 allows only FillFactor to be set. See the documentation: http://msdn.microsoft.com/en-us/library/aa2582 ...