-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from RENCI-NRIG/outofmemoryfix
Outofmemoryfix
- Loading branch information
Showing
15 changed files
with
419 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
docker stop $(docker ps -aq) | ||
docker rm $(docker ps -aq) | ||
docker rmi -f $(docker images -q) | ||
docker network rm $(docker network ls --format "{{.ID}}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# default log level is fatal | ||
# uncomment to enabled logging to stdout | ||
#log4j.rootCategory = ERROR, stdout, file | ||
#log4j.rootCategory = FATAL, file | ||
log4j.rootLogger = WARN, stdout, file | ||
|
||
# file logging | ||
log4j.appender.file = org.apache.log4j.RollingFileAppender | ||
log4j.appender.file.File = logs/imageService.log | ||
log4j.appender.file.layout = org.apache.log4j.PatternLayout | ||
log4j.appender.file.layout.ConversionPattern = %d-[%t]-{%-5p}-%c-(%F:%L)-%m%n | ||
log4j.appender.file.MaxFileSize = 10MB | ||
log4j.appender.file.MaxBackupIndex = 10 | ||
# stdout logging | ||
log4j.appender.stdout = org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern = %d-[%t]-{%-5p}-%c-(%F:%L)-%m%n | ||
|
||
|
||
log4j.category.org.renci.exogeni.image.service=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/org/renci/exogeni/image/service/api/ApiException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/renci/exogeni/image/service/api/ImageSizeApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* NOTE: This class is auto generated by the swagger code generator program (3.0.3). | ||
* https://github.com/swagger-api/swagger-codegen | ||
* Do not edit the class manually. | ||
*/ | ||
package org.renci.exogeni.image.service.api; | ||
|
||
import io.swagger.annotations.*; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.*; | ||
import java.util.List; | ||
import java.util.Map; | ||
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-23T14:40:10.501-04:00[America/New_York]") | ||
|
||
@Api(value = "imageSize", description = "the imageSize API") | ||
public interface ImageSizeApi { | ||
|
||
@ApiOperation(value = "returns image size given image id", nickname = "imageSizeGet", notes = "returns image size given image id ", response = String.class, tags={ }) | ||
@ApiResponses(value = { | ||
@ApiResponse(code = 200, message = "OK", response = String.class), | ||
@ApiResponse(code = 400, message = "Bad Request"), | ||
@ApiResponse(code = 403, message = "Forbidden"), | ||
@ApiResponse(code = 404, message = "Not Found"), | ||
@ApiResponse(code = 500, message = "Internal Server Error"), | ||
@ApiResponse(code = 200, message = "Unexpected Error") }) | ||
@RequestMapping(value = "/imageSize", | ||
produces = { "text/plain" }, | ||
method = RequestMethod.GET) | ||
ResponseEntity<String> imageSizeGet(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "project", required = true) String project,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "userName", required = true) String userName,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "password", required = true) String password,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "imageId", required = true) String imageId); | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/org/renci/exogeni/image/service/api/ImageSizeApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.renci.exogeni.image.service.api; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.swagger.annotations.*; | ||
import org.renci.exogeni.image.service.oscontroller.ImageServiceException; | ||
import org.renci.exogeni.image.service.oscontroller.OsImageController; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestHeader; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.constraints.*; | ||
import javax.validation.Valid; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-23T14:40:10.501-04:00[America/New_York]") | ||
|
||
@Controller | ||
public class ImageSizeApiController implements ImageSizeApi { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(ImageSizeApiController.class); | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
private final HttpServletRequest request; | ||
|
||
@org.springframework.beans.factory.annotation.Autowired | ||
public ImageSizeApiController(ObjectMapper objectMapper, HttpServletRequest request) { | ||
this.objectMapper = objectMapper; | ||
this.request = request; | ||
} | ||
|
||
public ResponseEntity<String> imageSizeGet(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "project", required = true) String project,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "userName", required = true) String userName,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "password", required = true) String password,@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "imageId", required = true) String imageId) { | ||
String accept = request.getHeader("Accept"); | ||
|
||
OsImageController osImageController = null; | ||
try { | ||
osImageController = new OsImageController(project, userName, password); | ||
|
||
Integer imageSize = osImageController.getImageDetails(imageId); | ||
ResponseEntity<String> responseEntity = new ResponseEntity<String>(HttpStatus.OK); | ||
|
||
return ResponseEntity.ok().contentType(MediaType.parseMediaType("text/plain")).body(imageSize.toString()); | ||
} | ||
catch (ImageServiceException e) { | ||
log.error("Exception occurred e=" + e); | ||
e.printStackTrace(); | ||
return new ResponseEntity<String>(e.getStatus()); | ||
} | ||
catch (Exception e) { | ||
log.error("Exception occurred e=" + e); | ||
e.printStackTrace(); | ||
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/org/renci/exogeni/image/service/api/NotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.