Redshift UNLOAD statement get's canceled after 19min - timeout

I'm trying to UNLOAD to s3 a large (6GB) data set using this utility (https://github.com/awslabs/amazon-redshift-utils/blob/master/src/UnloadCopyUtility/redshift-unload-copy.py) from an EC2 instance.
but the UNLOAD statement gets cancelled after 19min and 60 second (I have tried 2 times already)
pg.OperationalError: ERROR: Query (712244) cancelled on user's request
I have checked the statement_timeout param in my redshift config and it is set to 0. Anyone can tell me what it stops after 20 min?

This timeout is set right in the code of that utility: https://github.com/awslabs/amazon-redshift-utils/blob/94eb6d388c2b19e1609ef3a602c9bffba9211734/src/UnloadCopyUtility/redshift-unload-copy.py#L44
set_timeout_stmt = "set statement_timeout = 1200000"
Just change it to whatever you like.

Related

typeorm SQLITE_BUSY:database is locked

I'm using multiple processes to write and read to an sqlite DB and am running into a busy error:Error: SQLITE_BUSY: database is locked.
Then I try to set the enableWAL parameter to true and the busyErrorRetry parameter to 300 milliseconds. Finally,When the problem occurs again,SQLITE_BUSY error will not be reported at this time,But the sqlite database seems to be locked.I don't know if retries are too frequent, which aggravates the problem.
I think the retry parameter busyErrorRetry is not a good behavior.I want to use the PRAGMA busy_timeout = parameter, but typeomr does not support it.

Cypress Time out not respecting the value given on command

Since our test agents are slow some times- i am trying to add some additional time outs for some commands
I did it like using time out value on command as shown below.But its not respecting the value given
My understanding is cypress will wait for "10000" MS for getting the #Addstory element?
Can any one advice is this is the correct way please?
Thank you so much
cy.get('#addstory > .ng-scope').click({ timeout: 10000 })
In cypress.json file, increase the timeout to 10 seconds or what ever timeout you want like this: "defaultCommandTimeout": 10000 and save the file. Now close the app and open it again. Navigate to Settings > Configuration you should be able to see the new value set for defaultCommandTimeout.
I issue was i was adding time out on click not for getting the element when i changed like below -All good waiting for add story to be visible as i expected before click
cy.get('#addstory > .ng-scope',{ timeout: 10000 }).click()

Python FTP hang

Say I want to use FTP in Python using the ftplib. I begin with this:
from ftplib import ftp
ftp = FTP('10.10.10.151')
If the FTP server is not online, however, it will hang right there indefinitely. The only thing that can kick it out is a keyboard interrupt as far as I know. I've tried this:
ftp.connect('10.10.10.151','21', 5)
With the five being a five second timeout. But the problem here is that I do not know of any way to use that line without first assigning ftp something. But if the server is offline, then the "ftp =" line will hang. So what use is ftp.connect()'s timeout function?!?
Does anybody know a workaround or anything? Is there a way to time out the "ftp = FTP(xxx)" command that I haven't found? Thanks.
I'm using Python 2.7 on Linux Mint.
Your call to connect() is redundant since FTP() method documentation states:
When host is given, the method call connect(host) is made.
Also, since Python 2.6, FTP() does have a timeout parameter:
class ftplib.FTP([host[, user[, passwd[, acct[, timeout]]]]])
The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if is not specified, the global default timeout setting will be used).

Timeout issue using codefirststoredprocs in MVC5/EF 6. Error reading from stored proc dbo.[...]: Timeout expired

In order to process nearly 70K records at a time, I use codefriststoredprocs 2.5.0 with my application. With few records everything works fine but with large set of data, I receive "The wait operation timed out" exception.
I tried modifying default command timeout value from 30 seconds to 600 seconds in following manner.
//Previous approach
((System.Data.Entity.Infrastructure.IObjectContextAdapter)this.db).ObjectContext.CommandTimeout = 600;
//New approach for EF 6
this.db.Database.CommandTimeout = 600;
but still receives connection timeout message after 30 seconds. I also modified web.config setting Connection timeout value to 600 seconds (I know it is a different thing than command timeout value but give it a go).
I feel like the issue is with codefirststoredprocs library that while executing stored procedure change command timeout value to default. Is there any way to fix this issue or should I go to alternate approach of using stored procedures with my application.
Thanks in advance.
First, I would like to thanks CodeFirstStoredProcs team for their effort and collaboration to solve this issue.
I guess, as mentioned earlier, the command timeout values might have been defaulted to 30 seconds inside CodeFirstStoredProcs library.
With their new release (version 2.6),they have added ‘command timeout’ parameter to the CallStoredProc<> method, that helped me set a default value for commandtimeout
and finally solved my issue.
To process nearly 70K records in my case, I set CommandTimeout = 0 to CallStoredProc<> method. This adds an infinite waiting time to execute stored
procedure.
Thanks once again for CodeFirstStoredProcs team. :)
I got the same problem when changing to EF6.
Your might be setting the CommandTimeout in wrong place. Try setting the CommandTimeout where you are creating the context, like this:
var context = new Entities();
context.CommandTimeout = 600;
Also check if the CommandTimeout was changed with your approach after creating the context. If so then there might be some other issue.

Net-ssh timeout for execution?

In my application I want to terminate the exec! command of my SSH connection after a specified amount of time.
I found the :timeout for the Net::SSH.start command but following the documentation this is only for the initial connection. Is there something equivalent for the exec command?
My first guess would be not using exec! as this will wait until the command is finished but using exec and surround the call with a loop that checks the execution status with every iteration and fails after the given amount of time.
Something like this, if I understood the documentation correctly:
server = NET::SSH.start(...)
server.exec("some command")
start_time = Time.now
terminate_calculation = false
trap("TIME") { terminate_calculation = ((Time.now - start_time) > 60) }
ssh.loop(0.1) { not terminate_calculation }
However this seems dirty to me. I expect something like server.exec("some command" { :timeout=>60}). Maybe there is some built in function for achieving this functionality?
I am not sure if this would actually work in a SSH context but Ruby itself has a timeout method:
server = NET::SSH.start ...
timeout 60 do
server.exec! "some command"
end
This would raise Timeout::Error after 60 seconds. Check out the docs.
I don't think there's a native way to do it in net/ssh. See the code, there's no additional parameter for that option.
One way would be to handle timeouts in the command you call - see this answer on Unix & Linux SE.
I think your way is better, as you don't introduce external dependencies in the systems you connect to.
Another solution is to set ConnectTimeout option in OpenSSH configuration files (~/.ssh/config, /etc/ssh_config, ...)
Check more info in
https://github.com/net-ssh/net-ssh/blob/master/lib/net/ssh/config.rb
what I did is have a thread that's doing the event handling. Then I loop for a defined number of seconds until channel closed.If after these seconds pass, the channel is still open, then close it and continue execution.

Resources