How to use Bamboo REST API metod chart - api

Could you help me to understand how to get information from the method "chart"?
http://myhost.com:8085/bamboo/rest/api/latest/chart [GET]
Here output:
{"message":"Plans not found","status-code":404}
http://myhost.com:8085/bamboo/rest/api/latest/chart/reports [GET]
here output:
{"expand":"reports","link":{"href":"http://myhost.com:8085/bamboo/rest/api/latest/chart/reports","rel":"self"},"reports":{"size":15,"start-index":0,"max-result":15,"report":[{"key":"com.atlassian.bamboo.plugin.system.reports:agentUtilization","name":"Agent Utilization"},{"key":"com.atlassian.bamboo.plugin.system.reports:numberOfBuilds","name":"Build Activity"},{"key":"com.atlassian.bamboo.plugin.system.reports:averageDuration","name":"Build Duration"},{"key":"com.atlassian.bamboo.plugin.system.reports:averageQueuedDuration","name":"Build Queued Duration"},
...
and other com.atlassian.bamboo.plugin. How to use it?
http://myhost.com:8085/bamboo/rest/api/latest/chart/planSummary [GET]
Here output:
{"message":"Plan not found","status-code":404}

Related

Scrapy - get depth level of failed requests with no response

When parsing scraped pages I also save the depth the request was scraped from using response.meta['depth'].
I recently started using errback to log all failed requests into a separate file and having depth there would help me a lot. (I believe) I could use failure.value.response.meta['depth'] for those pages which actually got a response but failed due to ie a http status error like 403 etc., however when an error like TCPTimeout is encountered there is no response.
Is it possible to get the depth level of a failed request with no response?
EDIT1: Tried failure.request.meta['depth'] but that gives an error. Meta seems that can be found but it has no depth key.
EDIT2: The issue seems to be that failure.request.meta['depth'] is created only when the first response is received. So the way I understand is that if the first request, a start_url doesn't receive a response, the depth key is not yet created and hence throws an exception.
I'm going to experiment with this as per the depth middleware:
if 'depth' not in response.meta:
response.meta['depth'] = 0
Yep, the issue turns out to be exactly how I described it in EDIT2. This is how I fixed it:
def start_requests(self):
for u in self.start_urls:
yield scrapy.Request(u, errback=self.my_errback)
def my_errback(self, failure):
if 'depth' not in failure.request.meta:
failure.request.meta['depth'] = 0
depth = failure.request.meta['depth']
# do something with depth...
Big thanks to mr #Galecio who pointed me in the right direction!

Cloudwatch Logs Insights working with multiple #messages

I have the following query with the following output:
Query:
filter #message like /A:|B:/
Output:
[INFO] 2020-07-28T09:20:48.406Z requestid A: [{'Delivery': OK, 'Entry': 12323 }]
[INFO] 2020-07-28T09:20:48.407Z requestid B: {'MyValue':0}
I would like to print ONLY the A message when in the B message 'MyValue' = 0. For the above example, I would have to have the following output
Output:
[INFO] 2020-07-28T09:20:48.406Z requestid A: [{'Delivery': OK, 'Entry': 12323 }]
For the next example
[INFO] 2020-07-28T09:20:48.406Z requestid A: [{'Delivery': OK, 'Entry': 12323 }]
[INFO] 2020-07-28T09:20:48.407Z requestid B: {'MyValue':12}
The output should be empty
I can't do something like this because I miss the A message:
filter #message like /A:|B:/
filter MyValue = 0
Any ideas?
If anyone still interested, there IS ways to get the first and last from grouping by a field. So if you can fit your data into pairs of messages, it might help.
For example, given API Gateway access log (each row is a #message):
2021-09-14T14:09:00.452+03:00 (01c53288-5d25-*******) Extended Request Id: ***************
2021-09-14T14:09:00.452+03:00 (01c53288-5d25-*******) Verifying Usage Plan for request: 01c53288-5d25-*******. API Key: API Stage: **************/dev
2021-09-14T14:09:00.454+03:00 (01c53288-5d25-*******) API Key authorized because method 'ANY /path/{proxy+}' does not require API Key. Request will not contribute to throttle or quota limits
2021-09-14T14:09:00.454+03:00 (01c53288-5d25-*******) Usage Plan check succeeded for API Key and API Stage **************/dev
2021-09-14T14:09:00.454+03:00 (01c53288-5d25-*******) Starting execution for request: 01c53288-5d25-*******
2021-09-14T14:09:00.454+03:00 (01c53288-5d25-*******) HTTP Method: GET, Resource Path: /path/json.json
2021-09-14T14:09:00.468+03:00 (01c53288-5d25-*******) Method completed with status: 304
We can get method, uri and return code from the last 2 rows.
To do this, I parse the relevant data into params, and then get them by doing aggregation by request id (that i also parse)
The magic is: using stats likesortsFirst() and sortsLast() and grouping by #reqid. (AWS Docs
Note: IMO, don't use earliest() and latest() as they depend on built-in #timestamp and worked weird for me where 2 sequential messages had the same timestamp
So, for example, using this query:
filter #message like "Method"
| parse #message /\((?<#reqid>.*?)\) (.*?) (Method: (?<#method>.*?), )?(.*?:)* (?<#data>[^\ ]*)/
| sort #timestamp desc
| stats sortsFirst(#method) as #reqMethod, sortsFirst(#data) as #reqPath, sortsLast(#data) as #reqCode by #reqid
| limit 20
We would get the following desired output:
#reqid #reqMethod #reqPath #reqCode
f42e2b44-b858-45cb-***************** GET /path-******.json 304
fecddb03-3804-4ff5-***************** OPTIONS /path-******.json 200
e8e47185-6280-4e1e-***************** GET /path-******.json 304
e4fa9a0c-6d75-4e26-***************** GET /path-******.json 304

How to GET Job ID in perform action in activejob (adapter=resque) in Rails

I can get the JOB ID from before_enqueue method
e.g.
before_enqueue do |job|
puts "Before Enqueu JOB ID: #{job.job_id}"
end
BUT I want to get it also in perform method
Please Help!

CarrierWave file does not show up

So when I get the image upload, the show page confirms that the registration was successful, but does not show the image. I get:
Charle was successfully updated.
Title: yes
Name: john doe
?1310250102
Edit | Back
This is the error I get in terminal when running the server
Started GET "/images/?1310250102" for 127.0.0.1 at Tue Jul 12 11:42:15 -0400 2011
ActionController::RoutingError (No route matches "/images"):
Rendered /usr/local/lib/ruby/gems/1.8/gems/actionpack-3.0.7/lib/action_dispatch/middleware /templates/rescues/routing_error.erb within rescues/layout (2.1ms)
This is what my routes file looks like:
Evergreen::Application.routes.draw do
resources :charles
I had the same problem and it seemed to be caused by a piece of code that I picked up from another answer and added to my code with out understanding it:
def image=(val)
if !val.is_a?(String) && valid?
image_will_change!
super
end
end
Do you also happen to be using this code? I removed it completely and that solved the problem!

How to upload image on elgg using rest url?

I am trying to athenticate from the elgg local server.
by refering
http://www.danielansari.com/wordpress/2008/12/how-to-use-the-rest-api-in-elgg-11/
I am getting following error:
Status: **** ERROR (-1) ****
Message: Method call 'login' has not been implemented.
Result: exception 'APIException' with message 'Method call 'login' has not been implemented.' in C:\xampp\htdocs\elgg1.6.1\engine\lib\api.php:562
Stack trace:
#0 C:\xampp\htdocs\elgg1.6.1\services\api\rest.php(46): execute_method()
#1 C:\xampp\htdocs\elgg1.6.1\engine\lib\api.php(1219): include('C:\xampp\htdocs...')
#2 C:\xampp\htdocs\elgg1.6.1\engine\lib\pagehandler.php(42): api_endpoint_handler('login', Array, '')
#3 C:\xampp\htdocs\elgg1.6.1\engine\handlers\pagehandler.php(23): page_handler(Array, 'api')
#4 {main}
Basically my aim is to upload an image in a community made by using ELGG. But In this place only I am stuck.
How to solve it?
Well, I can't help you with that exception, but I can tell you that there is no way directly in Elgg's REST API to upload an image. I tried doing this and had to replicate the logic of the upload.php action in my own huge honking function.